本文整理汇总了Python中apache.aurora.config.AuroraConfig.loads_json方法的典型用法代码示例。如果您正苦于以下问题:Python AuroraConfig.loads_json方法的具体用法?Python AuroraConfig.loads_json怎么用?Python AuroraConfig.loads_json使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apache.aurora.config.AuroraConfig
的用法示例。
在下文中一共展示了AuroraConfig.loads_json方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _start_release
# 需要导入模块: from apache.aurora.config import AuroraConfig [as 别名]
# 或者: from apache.aurora.config.AuroraConfig import loads_json [as 别名]
def _start_release(self, api, context):
package, config_content = get_config(
context.options.jobspec, context.options.version or 'latest')
config = AuroraConfig.loads_json(config_content)
resp = api.start_job_update(config, message='Release started by %s.' % getpass.getuser())
if not resp.result:
return package, None
return package, resp.result.startJobUpdateResult.key.id
示例2: _job_diff
# 需要导入模块: from apache.aurora.config import AuroraConfig [as 别名]
# 或者: from apache.aurora.config.AuroraConfig import loads_json [as 别名]
def _job_diff(self, api, context, config_content):
# return true if jobs are diff, false if not
config = AuroraConfig.loads_json(config_content)
role, env, name = config.role(), config.environment(), config.name()
resp = api.query(api.build_query(role, name, env=env, statuses=ACTIVE_STATES))
context.log_response_and_raise(resp, err_code=EXIT_INVALID_PARAMETER,
err_msg="Could not find job to diff against")
if resp.result.scheduleStatusResult.tasks is None:
context.print_err("No tasks found for job %s" % context.options.jobspec)
return True
else:
remote_tasks = [t.assignedTask.task for t in resp.result.scheduleStatusResult.tasks]
resp = api.populate_job_config(config)
context.log_response_and_raise(resp, err_code=EXIT_INVALID_CONFIGURATION,
err_msg="Error loading configuration")
local_tasks = [resp.result.populateJobResult.taskConfig] * config.instances()
if len(remote_tasks) != len(local_tasks):
return True
for task1, task2 in zip(remote_tasks, local_tasks):
if task1 != task2:
return True
return False