Basicly I’m trying to call a function from another files in airflow.
I want to run a python function from a different files using airflow-docker
I am using this image : https://airflow.apache.org/docs/apache-airflow/2.3.1/docker-compose.yaml to run an airflow
Everything run smoothly when I am running a function within the same dag files.
But, when I go to my localhost airflow UI, I got error like this (no modules name includes)
I already add one line code in docker-compose.yaml (includes) file below the environment volumes :
But I still find the same error.
Is there anything I can do to fix the error ?
Any your helps will be appreciated much. Thank you !
2
Answers
By default, Airflow adds plugins and config folder in PYTHONPATH.
To add additional folders, you need to set them explicitly
Instead of modifying the
PYTHONPATH
environment variable or changing theairflow.cfg
configuration file, you can update thedocker-compose.yaml
file by modifying the volumes section as follows:This will mount the
./includes
directory on the host machine to the/opt/airflow/plugins/includes
directory in the container, making your custom modules available to Airflow without needing to modify any other configuration files or environment variables.