本文整理汇总了Python中writer.Writer.run方法的典型用法代码示例。如果您正苦于以下问题:Python Writer.run方法的具体用法?Python Writer.run怎么用?Python Writer.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类writer.Writer
的用法示例。
在下文中一共展示了Writer.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import run [as 别名]
def run(**kwargs):
params = get_params(kwargs)
configure_logging(params)
if only_instance_running(params):
logging.info('Starting execution.')
write_pid_file(params) # create lock to avoid concurrent executions
current_exec_time = utcnow()
config = load_config(params['config_path'])
config['current_exec_time'] = current_exec_time
config['query_folder'] = params['query_folder']
config['output_folder'] = params['output_folder']
config['reruns'], rerun_files = read_reruns(params['query_folder'])
reader = Reader(config)
selector = Selector(reader, config)
executor = Executor(selector, config)
writer = Writer(executor, config, configure_graphite(config))
writer.run()
delete_reruns(rerun_files) # delete rerun files that have been processed
delete_pid_file(params) # free lock for other instances to execute
logging.info('Execution complete.')
else:
logging.warning('Another instance is already running. Exiting.')
示例2: run
# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import run [as 别名]
def run(**kwargs):
params = get_params(kwargs)
configure_logging(params)
if only_instance_running(params):
logging.info('Starting execution.')
write_pid_file(params) # create lock to avoid concurrent executions
current_exec_time = utcnow()
last_exec_time = replace_exec_time(current_exec_time, params['history_path'])
if 'config' in params:
config = params['config']
else:
config = load_config(params['config_path'])
config['current_exec_time'] = current_exec_time
config['last_exec_time'] = last_exec_time
config['query_folder'] = params['query_folder']
config['output_folder'] = params['output_folder']
config['wikis_path'] = params['wikis_path']
reader = Reader(config)
selector = Selector(reader, config)
executor = Executor(selector, config)
writer = Writer(executor, config)
writer.run()
delete_pid_file(params) # free lock for other instances to execute
logging.info('Execution complete.')
else:
logging.warning('Another instance is already running. Exiting.')