Debugging Broken DAGs

混江龙づ霸主 提交于 2019-12-20 20:37:23

问题


When the airflow webserver shows up errors like Broken DAG: [<path/to/dag>] <error>, how and where can we find the full stacktrace for these exceptions?

I tried these locations:

/var/log/airflow/webserver -- had no logs in the timeframe of execution, other logs were in binary and decoding with strings gave no useful information.

/var/log/airflow/scheduler -- had some logs but were in binary form, tried to read them and looked to be mostly sqlalchemy logs probably for airflow's database.

/var/log/airflow/worker -- shows up the logs for running DAGs, (same as the ones you see on the airflow page)

and then also under /var/log/airflow/rotated -- couldn't find the stacktrace I was looking for.

I am using airflow v1.7.1.3


回答1:


Usually I used the command airflow list_dags which print the full stacktrace for python error found in dags.

That will work with almost any airflow command as airflow parse dags folder each time you use a airflow CLI command.




回答2:


If you want to compile and see any syntax error, you can also try python your_dag.py




回答3:


What you want to do is access the inner logs of the webserver so that you get the full stacktrace. My Airflow server is being executed in a Docker image so I'll use Docker to fetch these logs but the idea remains.

  1. docker ps
  2. fetch the PID of the webserver
  3. docker logs [PID]
  4. read the full logs of the given Airflow webserver.

This should contain the exact information of why your DAG build failed.



来源:https://stackoverflow.com/questions/43944741/debugging-broken-dags

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