Run same job multiple times in parallel threads #122
Replies: 2 comments 4 replies
-
Thanks for this! I have thought that allowing only one run per task should not be an issue because it's easy to create duplicates, but in this case, it's indeed not so. I think the only approach at the moment is to duplicate the tasks though. Perhaps it should be made so that the runs are separate from the tasks: we log which task started and we also log some sort of a run ID. There are still some problems: what is the definition of the task status if it was started twice and the other run succeeded? Is it running or was it a success? But I think we could have another attribute for tasks that releases the run lock and allows a specified task to be run multiple times at the same time. It should be only used when necessary as it can cause a mess in the log. This should be pretty easy to do at least so this could be the next step. Perhaps something like this: @app.task(multilaunch=True)
def do_things():
... The major problem is that if there is a condition that's not tied to the runs (ie. What's your opinion? What comes to the task queues, I had a brilliant (or stupid) idea yesterday. I'll open another discussion about it soon. |
Beta Was this translation helpful? Give feedback.
-
Hmmm... I see your point regarding task status and more over controlling/manipulating the task etc... Funny enough when looking at your #123 this is very close to what I'm trying to accomplish. Sticking to your example in #123 maybe we're adding a lot of person's into the database and process_person() is taking some time to process (e.g. I/O intense or whatever) so it would make also sense to be able to parallelise the process_person() ? |
Beta Was this translation helpful? Give feedback.
-
Using a slightly modified Task Queue example from (https://rocketry.readthedocs.io/en/stable/cookbook/controlling_runtime.html#task-queue)
I'd like to run the "same" task multiple times in parallel (executing="thread"). I know how to do it with different tasks but not with the same. How could I accomplish this (running job_a with arg 1 & job_a with arg 2 at the same time)?
output:
desired output:
Beta Was this translation helpful? Give feedback.
All reactions