Skip to content Skip to sidebar Skip to footer

How To Use Non-installable Modules From Dag Code?

I have a Git repository which (among other things) holds Airflow DAGs in airflow directory. I have a clone of the repository besides an install directory of Airflow. airflow direct

Solution 1:

Re-writing conclusion from discussions here


Broadly, there are 2 possible ways

  1. Package your code into an Airflow plugin
  2. Make your code discoverable to dag-definition-file(s) parsing processes by updating PYTHONPATH. Here again we have following options

    (a) Update PYTHONPATH on system level using bashrc / equivalent (once-and-for-all) or just export the updated PYTHONPATH for current bash session

    (b) Programmatically update sys.path in the beginning of DAG-definition file

Post a Comment for "How To Use Non-installable Modules From Dag Code?"