Created
June 18, 2018 20:47
-
-
Save voberoi/8b1f028ab99a51bcda9dba9643552222 to your computer and use it in GitHub Desktop.
Cloud Composer Dependency Issue (June 2018)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import airflow | |
from airflow.operators.bash_operator import BashOperator | |
from airflow.models import DAG | |
from foo_dep import print_something | |
args = {"owner": "airflow", "start_date": airflow.utils.dates.days_ago(2)} | |
dag = DAG(dag_id="foo", default_args=args, schedule_interval="0 0 * * *") | |
a_bash_cmd = BashOperator(task_id="a_bash_cmd", bash_command="echo 1", dag=dag) | |
if __name__ == "__main__": | |
dag.cli() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_something(): | |
print "Something." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
For posterity, create packages instead of modules at the top-level, like so:
Make sure
foo_dag
imports the dependency correctly. The Gist above won't work, butfrom foo_dep.foo_dep import print_something
will.Now, zip that folder structure and upload it to your
/dags
folder on GCS. Your Airflow environment will pick it up.