How to restart webserver in Cloud Composer

Viewed 2498

We recently met a known issue on airflow:

Airflow "This DAG isnt available in the webserver DagBag object "

Now we used a temporary solution to restart whole environment by changing configurations but this is not an efficient method. The best workaround now we think is to restart webservers on cloud composer, but we didn't find any command to restart webserver. Is it a possible action?

Thanks!

5 Answers

Only certain types of updates will cause the webserver container to be restarted, like adding, removing, or upgrading one of the PyPI packages or like changing an Airflow setting.

You can do for example:

# Set some arbitrary Airflow config value to force a webserver rebuild. 
gcloud composer environments update ${ENVIRONMENT_NAME} \
  --location=${ENV_LOCATION} \
  --update-airflow-configs=dummy=true

# Remove the previously set config value. 
gcloud composer environments update ${ENVIRONMENT_NAME} \ 
  --location=${ENV_LOCATION} \
  --remove-airflow-configs=dummy

From Google Cloud Docs:

gcloud beta composer environments restart-web-server ENVIRONMENT_NAME --location=LOCATION

From console dags can be retrieved, we can list all dag present. There other commands too.

Related