def main():
parser = argparse.ArgumentParser(description=help)
parser.add_argument('job_definition_filename', type=str)
parser.add_argument('image_url', type=str)
parser.add_argument('--deregister', action='store_true',
help='Deregister old verison of the job definition after updating')
args = parser.parse_args()
path_to_config_json = os.path.join('.', 'job-definitions',
args.job_definition_filename)
with open(path_to_config_json, 'r') as json_file:
job_definition = json.load(json_file)
job_definition['containerProperties']['image'] = args.image_url
client = boto3.client('batch')
response = client.register_job_definition(**job_definition)
if args.deregister:
old_revision = int(response['revision']) - 1
old_job_definition = '{}:{}'.format(response['jobDefinitionName'], old_revision)
client.deregister_job_definition(jobDefinition=old_job_definition)
print('{}:{}'.format(response['jobDefinitionName'], response['revision']), end='')
update_job_definition.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录