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


Python Configuration.read方法代码示例

本文整理汇总了Python中configuration.Configuration.read方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.read方法的具体用法?Python Configuration.read怎么用?Python Configuration.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在configuration.Configuration的用法示例。


在下文中一共展示了Configuration.read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cli

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read [as 别名]
def cli(config_path, test_name_prefix, redeploy_activestore):
    logging.basicConfig(level=logging.INFO,
                        format="%(asctime)s [%(levelname)s] %(message)s",
                        handlers=[logging.StreamHandler()])
    logging.getLogger("paramiko").setLevel(logging.WARNING)

    config = Configuration.read(config_path)
    run_load_tests(config, test_name_prefix, redeploy_activestore)
开发者ID:MayerRoman,项目名称:Lagerta,代码行数:10,代码来源:load_test.py

示例2: get_configs

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read [as 别名]
    def get_configs(self, path):
        c = Configuration(path=path)
        c.required = {
            'hostname',
            'username',
            'password',
            'vhost',
            'exchange',
            'queue',
        }
        c.accepted = {
            'durable_queue',
            'auto_delete_queue',
            'exchange_type',
            'durable_exchange',
            'auto_delete_exchange',
            'timeout',
        }
        if not c.read():
            raise Exception('Configuration file not set properly.')
        configs = c.result

        if 'durable_queue' in configs:
            configs['durable_queue'] = bool(configs['durable_queue'])
        else:
            configs['durable_queue'] = True

        if 'auto_delete_queue' in configs:
            configs['auto_delete_queue'] = bool(configs['auto_delete_queue'])
        else:
            configs['auto_delete_queue'] = False

        if 'exchange_type' not in configs:
            configs['exchange_type'] = 'fanout'

        if 'durable_exchange' in configs:
            configs['durable_exchange'] = bool(configs['durable_exchange'])
        else:
            configs['durable_exchange'] = True

        if 'auto_delete_exchange' in configs:
            configs['auto_delete_exchange'] = bool(configs['auto_delete_exchange'])
        else:
            configs['auto_delete_exchange'] = False

        if 'timeout' in configs:
            configs['timeout'] = int(configs['timeout'])
        else:
            configs['timeout'] = None

        return configs
开发者ID:davidozhang,项目名称:hoppity,代码行数:53,代码来源:client.py

示例3: vars

# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read [as 别名]
    )
    args = vars(parser.parse_args())

    c = Configuration(path=args['configuration'])
    c.required = {
        'hostname',
        'username',
        'password',
        'vhost',
        'queue',
    }
    c.accepted = {
        'num_threads',
        'timeout',
    }
    if not c.read():
        raise Exception('Configuration file not set properly.')
    configs = c.result

    if 'timeout' in configs:
        configs['timeout'] = int(configs['timeout'])
    else:
        configs['timeout'] = None

    if 'num_threads' in configs:
        num_threads = int(configs['num_threads'])
        pool = eventlet.GreenPool(size=int(configs['num_threads']))
    else:
        num_threads = 1000
        pool = eventlet.GreenPool()
开发者ID:davidozhang,项目名称:hoppity,代码行数:32,代码来源:worker.py


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