Closed rmoreas closed 1 year ago
I did some more investigation by using Flower to get better insight of what is going on.
It seems that the sync_path
, sync_dir
and sync_files
tasks are correctly executed by one and only one worker, but the post_job
handler is called multiple times per job.
So this is a real bug? Okay. We'll definitely poke at it to confirm and fix.
I doubt that this line is correct:
done = job.tasks_handle().decr() and not job.periodic()
I my understanding the job is done if the tasks count drops to zero: that is if job.tasks_handle().decr() == 0
. Below zero should never happen.
It seems that commit 45e04b46 introduced this bug, The original code before this commit was:
done = retry(logger, decr_with_key, r, tasks_key, job_name) == 0 and not retry(logger, periodic, r, job_name)
So before the condition was indeed == 0
.
Here a PR #202
Thanks for the contribution, @rmoreas!
I'm going to leave this open for now so that I can add a test.
I have written a test which demonstrates the fix for post_job. PR to come Soon
nice.
I can't get my head around the processing of tasks when using concurrent worker threads/processes (worker concurrency > 1).
I would think that each task is processed once by one worker process/thread, but it seems that individual tasks are executed multiple times by different workers. See for example the log snippets below: the
sync_dir
task is added multiple times by different workers for the same job.Also the
post_job
handler seems to be called multiple times by different workers for the same job, as can been seen in log snippets below; the log message "Checking marker files: ..." is created in thepost_job
handler.What am I missing here? Is this working as designed?
/cc @alanking @trel