Static file import in DAG is not reloaded on the scheduler #30281
-
|
Using Airflow 2.5.1, deployed through the 1.8.0 helm chart. We're using lot's of external modules which are all located and imported through the /plugins folder. These are all simple Python modules, not AirflowPlugins. A generic set of import in our DAGs looks something like this: When pushing the changes to the correct branch, the gitsync sidecar updates all modules & files and syncs them to the scheduler pod (I confirmed this by actually tailing the python files in question in the airflow-scheduler container). After several seconds/minutes, all of these changes come through in the UI. EXCEPT for changes to our dag_names file: it is not a package, class or method, but a simple python file containing strings. Whenever we're updating this file, the changes are synced to the scheduler pod but aren't synced to the Airflow UI. Currently we're fixing this by restarting the scheduler pod everytime we're adding a DAG to our list of DAG names. Why is this happening? Are we importing the file in a bad manner? Is Airflow unable to package a static file? Or should we review our usage of external python modules and start using AirflowPlugin wrappers instead? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
What exactly do you expect to be changed? Can you provide content of your |
Beta Was this translation helpful? Give feedback.
-
|
I got it to work: it was both a Python packaging & airflow issue. Had to add the following to the chart to force redeploy the scheduler once plugins we're changed: Next to that I needed to specify init.py files in the |
Beta Was this translation helpful? Give feedback.
-
|
@potiuk I'm again experiencing issues with this; especially on a folder called 'variables'. I just read this:
Is there a quick way to check if the 'variables' module is already defined somewhere in airflow? I'm clueless, I've tested everything else: x my modules contain the init.py files x I've configured my chart correctly to reload the plugins: But still, whenever I change the static file: I get the following error on every DAG in my repository: WHYYYYYY |
Beta Was this translation helpful? Give feedback.


Ah yes. of course. if you want to RELOAD plugins in scheduler you need to restart it. I thought the problem was with variables not with reloading. Scheduler does not have hot plugin reload - only webserver (and DagFileProcessor).
Hot reloading is next to impossible to be done in Python for multiple reasons. The only way it works in Webserver is because it actually has N processes and they kept on being restarted regularly as they are just statelessly handling requests and lazy loading of plugins make them load only after the worker processes start., Similarly DAGFileProcessor forks a new process every time it parses a file so plugins (and any other imported python modiules) are loaded aft…