Search code examples
google-cloud-platformairflowairflow-schedulergoogle-cloud-composer

I want to change the timezone of the airflow webserver created by cloud composer from utc to jst (Asia / Tokyo)


I want to change the timezone of the airflow webserver created by cloud composer from utc to jst (Asia / Tokyo).

However, even if "webserver-default_ui_timezone ='JST'" is set by airflow config overwrite, the time of webserver cannot be changed.

Even if I changed the time zone of the VM (GKE node) used in airflow from utc to jst (Asia / Tokyo), there was no change in the web server.

How can I change the display time and time zone of webserver and DAG to jst (Asia / Tokyo)?


Solution

  • I understand that default_ui_timezone is the correct Airflow setting to achieve what you are looking for, so it should be related to the way you are trying to set the value. Besides, this setting is not included in the blocked Airflow configurations list.

    From GCloud CLI, try this command replacing the following with your environment and region names:

    gcloud composer environments update test-environment \
      --location you-region-1 \
      --update-airflow-configs=webserver-default_ui_timezone=JST
    

    From the Cloud Composer docs:

    gcloud composer environments update ENVIRONMENT_NAME \
      --location LOCATION \
      --update-airflow-configs=KEY=VALUE,KEY=VALUE,...
    
    • ENVIRONMENT_NAME with the name of the environment.
    • LOCATION with the Compute Engine region where the environment is located.
    • KEY with the configuration section and the option name separated by a hyphen, for example, core-print_stats_interval.
    • VALUE with the corresponding value for an option.

    In case you need it, in the docs provided above, there are also examples of how to set Airflow configuration values from Console or API. Good luck!