本文整理汇总了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)
示例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
示例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()