8

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!

Bruce Kuo
  • 191
  • 1
  • 11
  • 2
    We're having the same issue and it's quite annoying – Tobi Jan 15 '19 at 14:49
  • Not resurrect an old thread on purpose, but I've ran into similar issue where it seems like web server and scheduler had out of sync files; which would break your DAGs if you have some dynamic logic going on. (maybe similar to http://mail-archives.apache.org/mod_mbox/airflow-dev/201805.mbox/%3CSHAPR01MB0470620933204B14A09CDBBCB9D0@SHAPR01MB047.CHNPR01.prod.partner.outlook.cn%3E) Does updating configs on composer also restart all the scheduler/worker images? (is there a way I can tell?) People often say it improves airflow performance if you restart the scheduler now and then, if there's also t – the pillow Feb 16 '20 at 21:59

5 Answers5

1

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
zessx
  • 68,042
  • 28
  • 135
  • 158
Temu
  • 859
  • 4
  • 11
  • Yes, I restart my cloud composer by this hack but I don't this this is the best way or experience to do it because this command forces cloud composer to rebuild image and deploy to each node. It is too heavy in my mind. – Bruce Kuo Apr 11 '19 at 03:39
  • It is, but for restarting Cloud Composer you'll need to rebuild and redeploy, maybe not always necessary but... just in case. – Temu Apr 11 '19 at 08:09
  • need to change the command to `gcloud composer environments update ${ENVIRONMENT_NAME} --location=${ENV_LOCATION} --update-airflow-configs=webserver-dummy=true` since Composer now has "sections" for the different configs. – Ryan Shirley Feb 26 '20 at 17:53
1

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

GregK
  • 571
  • 6
  • 15
0

From Google Cloud Docs:

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

Franco Piccolo
  • 6,845
  • 8
  • 34
  • 52
-1

I finally found an alternative solution!

Based on this document: https://cloud.google.com/composer/docs/how-to/managing/deploy-webserver

We can build airflow webservers on kubernetes (Yes, please throw away built-in webserver). So we can kill webserver pods to force restart =)

Bruce Kuo
  • 191
  • 1
  • 11
-5

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

Omkara
  • 414
  • 4
  • 16
  • 1
    Could you explain what you are trying to say here in other words? I don't get this answer. – Bunyk Dec 13 '18 at 12:22