LoginSignup
1
1

More than 3 years have passed since last update.

Cloud Composer から実行する Cloud Dataflow のリージョンが他のものを指定しても us-east1 になってしまう問題

Posted at

問題

2020-01 時点で発生。

Cloud Composer から実行する Cloud Dataflow はその実行リージョンを指定することができるのだが、
https://airflow.apache.org/docs/stable/_modules/airflow/contrib/operators/dataflow_operator.html

example.py
default_args = {
    'owner': 'example',
    'start_date': datetime(2020, 1, 1),
    'dataflow_default_options': {
        'project': 'example-project-id',
        'region': 'asia-northeast1'
    }
}

with DAG(
    'example_dag',
    default_args=default_args,
    schedule_interval=None
)as dag:

    taskImport = DataflowTemplateOperator(
        task_id='dataflow',
        template='gs://example-templates/templates/hoge',
        dag=dag
    )

実際に実行すると、ここで指定したリージョンではなく us-east1 になってしまう。

解決法

Airflow のバグなのでバージョンを上げる必要あり。
https://issues.apache.org/jira/browse/AIRFLOW-2715

2019-05-16 に GCP 上でバックポート修正版がリリースされている。
GCP 版 Airflow のバージョンが 1.10.2 以降で対応。
https://cloud.google.com/composer/docs/release-notes#May_16_2019

2020-01 現在、Terraform でバージョン指定なしで Cloud Composer 環境を作成したときには GCP 版 Airflow のバージョンが 1.10.2 より低いものになっているので注意。

example.tf
resource "google_composer_environment" "example" {
  name    = "example-composer"
  config {
    software_config {
      image_version  = "composer-latest-airflow-1.10"
    }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1