我有一个数据流项目,我将GoogleCloudOptions设置为:
google_cloud_options = options.view_as(GoogleCloudOptions)
google_cloud_options.project = my_settings.gcp_project_name
google_cloud_options.job_name = "{}-{}".format(my_settings.gcp_job_name, datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
google_cloud_options.staging_location = 'gs://some/staging'
google_cloud_options.temp_location = 'gs://some/temp'
google_cloud_options.template_location = 'gs://some/templates/some_template'
google_cloud_options.labels = ["dum=dum", "run=run"]
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://dataflow.googleapis.com/v1b3/projects/some_project/templates:launch?alt=json&gcsPath=gs%3A%2F%2Fsome%2Ftemplates%2Fsome_template returned "Unable to parse template file 'gs://some/templates/some_template'.">
这失败得很惨。
google_cloud_options = options.view_as(GoogleCloudOptions)
google_cloud_options.project = my_settings.gcp_project_name
google_cloud_options.job_name = "{}-{}".format(my_settings.gcp_job_name, datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
google_cloud_options.staging_location = 'gs://some/staging'
google_cloud_options.temp_location = 'gs://some/temp'
google_cloud_options.labels = ["dum=dum", "run=run"]
这实际上是在运行,为什么?理想情况下,我希望模板版本能够运行,我需要弄清楚如何正确地编译和解析模板。
google_cloud_options = options.view_as(GoogleCloudOptions)
google_cloud_options.project = my_settings.gcp_project_name
google_cloud_options.job_name = "{}-{}".format(my_settings.gcp_job_name, datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
google_cloud_options.staging_location = 'gs://some/staging'
google_cloud_options.temp_location = 'gs://some/temp'
google_cloud_options.template_location = 'gs://some/templates/some_template'
这也适用。
因此,在我看来,似乎将labels选项与template\u location选项一起添加会导致数据流失败。