I have a subfolder in my dags folder:
~/airflow/dags/subfolder/
Inside that folder I have several files:
dag_demo.py
sql_demo_1.py
sql_demo_2.py
Inside my dag definition I do an import:
import sql_demo_1
import sql_demo_2
I can test the dag via: python ~/airflow/dags/subfolder/dag_demo.py and it works fine.
However, if I do a `airflow list_dags` command I get the error:
[2016-02-15 18:05:09,389] {models.py:203} ERROR - Failed to import: /home/ubuntu/airflow/dags/subfolder/dag_demo.py
Traceback (most recent call last):
File "/home/ubuntu/anaconda2/envs/airflow/lib/python2.7/site-packages/airflow/models.py", line 201, in process_file
m = imp.load_source(mod_name, filepath)
File "/home/ubuntu/airflow/dags/subfolder/dag_demo.py", line 10, in <module>
import sql_demo_1
ImportError: No module named sql_demo_1
It's as if the dependencies, in the DAG subfolder, are not being seen by Airflow. Why is this?
I've also tried:
$ airflow list_dags -sd ~/airflow/dags/subfolder/
with the same result.