def run(self, max_loops=-1):
''' loops events structures to execute raise events and execute tasks.
Args:
max_loops: number of loops to run. If positive, limits number of loops.
defaults to negative, which would run loops until there are no events to raise and
no task to run.
'''
if setproctitle is not None:
run_id = "%s." % self.run_id if self.run_id else ''
setproctitle("eventor: %s" % (run_id,))
if max_loops < 0:
result=self.loop_session()
else:
result=None
for _ in range(max_loops):
#module_logger.debug('Starting loop cycle')
result=self.loop_cycle()
human_result="success" if result else 'failure'
total_todo, _=self.count_todos(with_delayeds=True)
module_logger.info('Processing finished with: %s; outstanding tasks: %s' % (human_result, total_todo))
#module_logger.info('Processing finished')
return result
评论列表
文章目录