worker_machine_type标记在使用python的Google Cloud Dataflow中无效

worker_machine_type标记在使用python的Google Cloud Dataflow中无效,第1张

概述我在Python中使用Apache Beam和Google Cloud Dataflow(2.3.0).将worker_machine_type参数指定为例如n1-highmem-2或custom-1-6656,Dataflow运行该作业,但始终为每个工作人员使用标准机器类型n1-standard-1.如果我做错了,有没有人知道?其他主题(here和here

我在Python中使用Apache Beam和Google Cloud Dataflow(2.3.0).将worker_machine_type参数指定为例如n1-highmem-2或custom-1-6656,Dataflow运行该作业,但始终为每个工作人员使用标准机器类型n1-standard-1.

如果我做错了,有没有人知道?

其他主题(here和here)表明这应该是可能的,因此这可能是版本问题.

我的用于指定PipelineOptions的代码(请注意,所有其他选项都可以正常工作,因此它应该识别worker_machine_type参数):

def get_cloud_pipeline_options(project):  options = {    'runner': 'DataflowRunner','job_name': ('converter-ml6-{}'.format(        datetime.Now().strftime('%Y%m%d%H%M%s'))),'staging_location': os.path.join(BUCKET,'staging'),'temp_location': os.path.join(BUCKET,'tmp'),'project': project,'region': 'europe-west1','zone': 'europe-west1-d','autoscaling_algorithm': 'THROUGHPUT_BASED','save_main_session': True,'setup_file': './setup.py','worker_machine_type': 'custom-1-6656','max_num_workers': 3,}  return beam.pipeline.PipelineOptions(flags=[],**options)def main(argv=None):  args = parse_arguments(sys.argv if argv is None else argv)  pipeline_options = get_cloud_pipeline_options(args.project_ID  pipeline = beam.Pipeline(options=pipeline_options)
最佳答案PipelineOptions在幕后使用argparse来解析其参数.在机器类型的情况下,参数的名称是machine_type,但是标志名称是worker_machine_type.这在以下两种情况下工作正常,其中argparse进行解析并知道这种别名:

>在命令行上传递参数.例如my_pipeline.py –worker_machine_type custom-1-6656
>将参数作为命令行标记传递,例如flags [‘ – worker_machine_type’,’worker_machine_type custom-1-6656′,…]

然而它与** kwargs不兼容.以这种方式传递的任何其他args用于替换已知的参数名称(但不是标志名称).

简而言之,使用machine_type可以在任何地方使用.我提交了https://issues.apache.org/jira/browse/BEAM-4112,以便将来在Beam中修复. 总结

以上是内存溢出为你收集整理的worker_machine_type标记在使用python的Google Cloud Dataflow中无效全部内容,希望文章能够帮你解决worker_machine_type标记在使用python的Google Cloud Dataflow中无效所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1206075.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存