How do I add a new dag to a running airflow service?

断了今生、忘了曾经 提交于 2019-12-22 10:01:40

问题


I have an airflow service that is currently running as separate docker containers for the webserver and scheduler, both backed by a postgres database. I have the dags synced between the two instances and the dags load appropriately when the services start. However, if I add a new dag to the dag folder (on both containers) while the service is running, the dag gets loaded into the dagbag but show up in the web gui with missing metadata. I can run "airflow initdb" after each update but that doesn't feel right. Is there a better way for the scheduler and webserver to sync up with the database?


回答1:


Dag updates should be picked up automatically. If they don't get picked up, it's often because the change you made "broke" the dag.

To check that new tasks are in fact picked up, on your webserver, run:

airflow list_tasks <dag_name> --tree

If it says Dag not found, then there's an error.
If it runs successfully, then it should show all your tasks and those tasks should be picked up in your airflow ui when you refresh it.

If the new/updated tasks are not showing up there, then check the dags folder on your webserver and verify that the code is indeed being updated.



来源:https://stackoverflow.com/questions/51885844/how-do-i-add-a-new-dag-to-a-running-airflow-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!