dum*_*kar 6 python google-cloud-dataflow apache-beam
我在Python中使用Apache Beam和Google Cloud Dataflow(2.3.0).将worker_machine_type参数指定为例如n1-highmem-2或时custom-1-6656,Dataflow运行作业但始终n1-standard-1为每个工作程序使用标准机器类型.
如果我做错了,有没有人知道?
其他主题(此处和此处)表明这应该是可能的,因此这可能是版本问题.
我的代码用于指定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)
Run Code Online (Sandbox Code Playgroud)
PipelineOptionsargparse在幕后使用来解析其参数。在机器类型的情况下,参数的名称是,machine_type但标志名称是worker_machine_type。这在以下两种情况下工作得很好,其中 argparse 进行解析并意识到这种别名:
my_pipeline.py --worker_machine_type custom-1-6656flags['--worker_machine_type', 'worker_machine_type custom-1-6656', ...]然而,它不能很好地与**kwargs. 以这种方式传递的任何附加参数都用于替换已知的参数名称(但不是标志名称)。
简而言之,使用machine_type无处不在。我提交了https://issues.apache.org/jira/browse/BEAM-4112,以便将来在 Beam 中修复此问题。
| 归档时间: |
|
| 查看次数: |
621 次 |
| 最近记录: |