Commit 50d756af authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Fix a race in rescheduling jobs

When handling the queue, in particular at analyzing job dependencies,
we assume that all non-finalized jobs are present in the Queue data
structure. When rescheduling jobs we move them from the running part
of the queue to the scheduled part again. In order to comply with the
just mentioned in variant, we need to do so in a single atomic
modification instead of sequentially modifying the data structure.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent dd6514c9
......@@ -229,8 +229,7 @@ requeueJobs qstate jobs err = do
rmJobs = filter ((`notElem` jids) . qjId . jJob)
logWarning $ "Starting jobs failed: " ++ show err
logWarning $ "Rescheduling jobs: " ++ jidsString
modifyJobs qstate (onRunningJobs rmJobs)
modifyJobs qstate (onQueuedJobs $ (++) jobs)
modifyJobs qstate $ onQueuedJobs (jobs ++) . onRunningJobs rmJobs
-- | Schedule jobs to be run. This is the IO wrapper around the
-- pure `selectJobsToRun`.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment