简体   繁体   English

更改 AWS Glue 作业参数的值

[英]Change value of AWS Glue Job Parameter

Is there a way that I can change the value of an AWS Glue job parameter in the job itself?有没有办法可以更改作业本身中 AWS Glue 作业参数的值? Let's say I have a parameter with a key of --color and value of 'red':假设我有一个带有 --color 键和“red”值的参数:

args = getResolvedOptions(sys.argv, ['color'])
color = args['color']

The above code will return 'red' for the variable color.上面的代码将为变量颜色返回“红色”。

How do I change this parameter so that the next time I run the job, the color parameter is blue?如何更改此参数,以便下次运行作业时,颜色参数为蓝色?

You can set "color" as default argument for the job, so that "red" is used if no "--color" is given.您可以将“color”设置为作业的默认参数,这样如果没有给出“--color”,则使用“red”。

To change the default to "blue" you will then need to update the job definition.要将默认设置更改为“蓝色”,您需要更新作业定义。 This could possibly be done from within the job itself if it is needed (by using boto3 and having necessary permissions).如果需要,这可以从作业本身内部完成(通过使用 boto3 并拥有必要的权限)。

Look for DefaultArguments :寻找DefaultArguments
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glue.html#Glue.Client.update_job https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glue.html#Glue.Client.update_job

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM