Reputation: 5355
Is there a way that I in airflow (maybe the config-file) can add /path/to/folder/
as a folder globally?
Right now I have to write
import sys
sys.path += ["/path/to/folder/"]
at the top of all my DAGs, which clearly is not very good, in case I change the folder to /another_path/to/folder
Upvotes: 0
Views: 1346
Reputation: 977
It depends on how you are running Airflow. Generally speaking, your DAGs should see the environment variables Airflow sees, I set PYTHON_PATH for example like this all the time.
If you are running it locally, just set from the command line like for any other process:
PATH=/some/path/to/append:$PATH [your airflow command]
Or if you're running in Docker, you can set it via the command line, docker-compose, or however else you'd like.
Though not directly related, this part of the Airflow docs may help:
Upvotes: 1