-
Hi All, In my search i just found procrastinate worker need to be restarted if we add new task function. by any chance i don't search deeply, Is procrastinate have ability to hot reload task function without reload/restart the worker, in my case i will add task queue logic on FastAPI so i just need restart the FastAPI as long as worker know the parent module ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey, thanks for your question! As far as I know, tasks are looked up by the worker on the app, so whenever a new task is dynamically added to the app in the current process, it will be available to the worker. I therefore understand your question as "the python code has been modified after it was imported, and I want the new tasks to be seen" ? In that case, I think I mentioned a few details here: #1246 I'm not an expert in Python reloading, so feel free to point any mistake, shortcoming or additional ideas that could be useful. |
Beta Was this translation helpful? Give feedback.
It all boils down to what exactly "dynamically" means. Also, I'm relying a lot here on Python's default behavior, so the limits we have is the limits Python has and the technical choices we made.
What I mean by dynamically is that if after the worker has started, some code running (e.g. called by a job) defines a new task, it will be available.
The problem you'll have is that by default, Python doesn't reload modules when they're changed. If a running Python interpreter has alrea…