当前位置: 首页>>代码示例>>Python>>正文


Python Writer.run方法代码示例

本文整理汇总了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.')
开发者ID:wikimedia,项目名称:analytics-reportupdater,代码行数:29,代码来源:reportupdater.py

示例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.')
开发者ID:wikimedia,项目名称:analytics-limn-mobile-data,代码行数:33,代码来源:reportupdater.py


注:本文中的writer.Writer.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。