本文整理汇总了Python中trace.Trace.info方法的典型用法代码示例。如果您正苦于以下问题:Python Trace.info方法的具体用法?Python Trace.info怎么用?Python Trace.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trace.Trace
的用法示例。
在下文中一共展示了Trace.info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upsert_bulk
# 需要导入模块: from trace import Trace [as 别名]
# 或者: from trace.Trace import info [as 别名]
def upsert_bulk(self, _index, type_key, id_key, bulk):
"Updates a bulk of documents in the same index."
"The type and id of each document are encoded in the document. Keys are provided to retrieve them"
"The type and id fields are removed in the document after inserted as _type and _id"
"Returns the number of documents upserted."
docs_upserted = 0
for document in bulk:
_type = document[type_key]
_id = document[id_key]
del document[type_key]
del document[id_key]
upserted = self.upsert_document(_index, _type, _id, document)
Trace.info("upserted: " + json.dumps(upserted))
if (upserted["_id"] == _id):
docs_upserted += 1
return docs_upserted