运行 使用 FlexTemplatesServiceClient 的数据流 flex 模板时如何设置区域
How to set region when running a dataflow flex template using FlexTemplatesServiceClient
我正在尝试使用 python FlexTemplatesServiceClient
启动数据流作业。我成功地创造了一份工作。但是,我的问题是无论我做什么,工作总是在 us-central1 地区结束。到目前为止我尝试过的是
flex_client = FlexTemplatesServiceClient.from_service_account_file(auth_info)
p = {
"project_id": "joyn-data-dev",
"location": "europe-west4",
"launch_parameter": {
"job_name": "some-name",
"container_spec_gcs_path": "gs://some-bucket/flex-template-spec.json",
"environment" : { # Tried using this, and not using this. nothing had an effect
"zone" : "europe-west4",
#"worker_zone": "europe-west4",
#"worker_region": "europe-west4",
}
},
}
response = flex_client.launch_flex_template(p)
到目前为止,这些都没有任何效果。当我使用 rest API 或 glcoud cli 启动完全相同的作业时,一切正常。因此,例如以下命令
gcloud dataflow flex-template run "somename-`date +%Y%m%d-%H%M%S`" \
--template-file-gcs-location "gs://some-bucket/flex-template-spec.json" \
--region europe-west4
工作正常,没有任何问题。
不幸的是,客户端 API 文档相当稀少,我在那里找不到任何帮助。希望有人面对类似的问题并解决它。
显然,在 API 的 GRPY 实现中有一个 bug 忽略了您指定的 region/location 配置。目前,如果您想以编程方式触发数据流,则必须使用其余 API。
我正在尝试使用 python FlexTemplatesServiceClient
启动数据流作业。我成功地创造了一份工作。但是,我的问题是无论我做什么,工作总是在 us-central1 地区结束。到目前为止我尝试过的是
flex_client = FlexTemplatesServiceClient.from_service_account_file(auth_info)
p = {
"project_id": "joyn-data-dev",
"location": "europe-west4",
"launch_parameter": {
"job_name": "some-name",
"container_spec_gcs_path": "gs://some-bucket/flex-template-spec.json",
"environment" : { # Tried using this, and not using this. nothing had an effect
"zone" : "europe-west4",
#"worker_zone": "europe-west4",
#"worker_region": "europe-west4",
}
},
}
response = flex_client.launch_flex_template(p)
到目前为止,这些都没有任何效果。当我使用 rest API 或 glcoud cli 启动完全相同的作业时,一切正常。因此,例如以下命令
gcloud dataflow flex-template run "somename-`date +%Y%m%d-%H%M%S`" \
--template-file-gcs-location "gs://some-bucket/flex-template-spec.json" \
--region europe-west4
工作正常,没有任何问题。
不幸的是,客户端 API 文档相当稀少,我在那里找不到任何帮助。希望有人面对类似的问题并解决它。
显然,在 API 的 GRPY 实现中有一个 bug 忽略了您指定的 region/location 配置。目前,如果您想以编程方式触发数据流,则必须使用其余 API。