Reputation: 1043
I placed a dag file in the dags folder based on a tutorial with slight modifications, but it doesn't show up in the GUI or when run airflow dags list.
Upvotes: 3
Views: 7496
Reputation: 46
I know you already answered yourself, but I can't comment and wanted to share a similar case.
A python file can be valid executable python, in the right place, with the correct permissions, and getting detected by Airflow... but it still won't show up unless a valid DAG object has been instantiated (and if not, no errors will be logged).
You also have to instantiate an object, not just call the function - in my case the DAG finally started appearing when I changed it like this...
from airflow.decorators import dag
@dag(...)
def the_dag()
...
the_dag() # <-- doesn't work
_ = the_dag() # <-- works
Upvotes: 1
Reputation: 1043
Answering my own question: Check the python file for Exceptions by running it directly. It turns out one exception in the dag's python script due to a missing import made the dag not show up in the list. I note this just in case another new user comes across this. To me the moral of the story is that dag files should often be checked by running with python directly when they are modified because there won't be an obvious error showing up otherwise; they may just disappear from the list.
Upvotes: 7