Somasundaram Sekar
Somasundaram Sekar

Reputation: 5524

Airflow: External python in python_callable of PythonOperator

I would like to import some python files as dependency in airflow and use an function in python_callable in PythonOperator. I tried placing the dependency python file in the dags folder, but doesn't seem to work. I'm assuming the DAG is being moved to some other folder, before being executed. Help appreciated!!

Upvotes: 1

Views: 1950

Answers (1)

R. Ilma
R. Ilma

Reputation: 186

Get an idea about your environment variable "AIRFLOW_HOME". If it is not declared, it points to your home directory by default. In airflow, the Python scripts are normally placed at "AIRFLOW_HOME"/airflow/dags You can place the Python script and it's dependencies there but I strongly recommend to create and package for the dependencies and install it in your Python environment along airflow and avoid the unnecessary clutter of files in your dag folders.

Upvotes: 3

Related Questions