I have an Airflow DAG with local python modules with the following structure:
- dags/
- __init__.py
- company/
- __init__.py
- common/
- __init__.py
- security/
- storage/
- providers/
- __init__.py
- all.py
- provider-a/
- my-dag.py
Inside 'dags/my-dag.py' load 'dags/company/providers/all.py' which that module load 'dags/company/providers/provider-a/process.py' which depends on two modules 'dags/company/common/storage/s3.py' and 'dags/company/common/security/connection.py'.
All setup works perfectly on a local Airflow and compiles nicely, but when I copy all the above to Google Cloud Composer, it failed with this error:
Broken DAG: [/home/airflow/gcs/dags/my-dag.py] module 'company' has no attribute 'common'.
I searched Stackoverflow and found others also have the exact same problem. The interesting part is when I drop all structure into only 1-level ('company/*.py') and refactor my module naming and references, then it works locally as well as in Composer.
It seems like the Composer has some different behavior or limitation than normal Airflow when it gets to a multi-hierarchy folder/module structure with inner-dependency.
I would appreciate it if anyone can help me with this.
Cheers,
Reza