本文整理汇总了Python中store.Store.push方法的典型用法代码示例。如果您正苦于以下问题:Python Store.push方法的具体用法?Python Store.push怎么用?Python Store.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.push方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: performTask
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import push [as 别名]
def performTask(self, task):
self.performing_task = task
# Creating new store
store = Store(task.index_fields)
# Reading data
self.state = 'reading data from log %s' % task.log
data = self.filekeeper.read(task.log)
logging.debug("[worker %s] read %d bytes from %s" % (task.collector_name, len(data), task.log))
# Parsing and pushing data
self.state = 'parsing data from log %s' % task.log
total = 0
parsed = 0
t1 = time.time()
for line in data.split('\n'):
record = task.parser.parseLine(line+'\n')
if task.parser.successful:
parsed += 1
# after_parse_callbacks
for callback in task.after_parse_callbacks:
func = callback[0]
args = [record] + callback[1:]
try:
func(*args)
except Exception, e:
logging.debug('[%s.%s] %s' % (func.__module__, func.__name__, repr(e)))
store.push(record)
total += 1