简体   繁体   English

在 AWS Glue 交互中提供参数 session

[英]Providing params in AWS Glue interactive session

I am trying to develop an AWS Glue job in pyspark using interactive sessions in AWS Glue.我正在尝试使用 AWS Glue 中的交互式会话在 pyspark 中开发 AWS Glue 作业。 To use job.init , I have seen in examples that the JOB_NAME is passed like so要使用job.init ,我在示例中看到JOB_NAME是这样传递的

args = getResolvedOptions(sys.argv, ['JOB_NAME'])
...
job.init(args['JOB_NAME'], args)

a) When I run the notebook in the Glue Studio Editor, I get: GlueArgumentError: the following arguments are required: --JOB_NAME . a) 当我在 Glue Studio 编辑器中运行笔记本时,我得到: GlueArgumentError: the following arguments are required: --JOB_NAME How do I set the parameter without running the whole job?如何在不运行整个作业的情况下设置参数?

b) Ultimately, I want to develop in VS Code. b) 最后,我想在 VS Code 中进行开发。 Is there a way to set the JOB_NAME parameter there?有没有办法在那里设置 JOB_NAME 参数?

In your Glue Interactive sessions notebook you can add required arguments manually by updating the sys.argv.在您的 Glue Interactive 会话笔记本中,您可以通过更新 sys.argv 手动添加所需的 arguments。 See the example below:请参见下面的示例:

sys.argv+=['--JOB_NAME', 'my_test_job']
args = getResolvedOptions(sys.argv,
                          ['JOB_NAME'])
print(args)

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

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