Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart webserver in Cloud Composer

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!

like image 315
Bruce Kuo Avatar asked Nov 12 '18 04:11

Bruce Kuo


People also ask

How do I restart Cloud Composer?

A way to restart Composer server is to add a 'dummy variable' into the 'Environment Variables' of GCP Composer UI. After submitting, it will restart to include this change.

How do you reset an Airflow environment?

How do I restart Airflow Services? You can do start/stop/restart actions on an Airflow service and the commands used for each service are given below: Run sudo monit <action> scheduler for Airflow Scheduler. Run sudo monit <action> webserver for Airflow Webserver.


2 Answers

For those who wander and find this thread: currently the for versions >= 1.13.1 Composer has a preview for a web server restart

like image 156
GregK Avatar answered Sep 18 '22 03:09

GregK


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
like image 35
Temu Avatar answered Sep 20 '22 03:09

Temu