From 3f200c245c043df5c1af962f8ddc9add11c557b7 Mon Sep 17 00:00:00 2001 From: Jeremie Dokime Date: Mon, 13 Jan 2014 15:17:58 +0100 Subject: [PATCH] Fix concurrency handling in order to avoid that some workers get the same task at the same time. --- gluon/scheduler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gluon/scheduler.py b/gluon/scheduler.py index 957d9836..620cf7b5 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -912,10 +912,10 @@ class Scheduler(MetaScheduler): ) if not task.task_name: d['task_name'] = task.function_name - task.update_record(**d) + db((st.id==task.id) & (st.status.belongs((QUEUED, ASSIGNED)))).update(**d) + db.commit() wkgroups[gname]['workers'][myw]['c'] += 1 - db.commit() #I didn't report tasks but I'm working nonetheless!!!! if x > 0: self.empty_runs = 0