Fix concurrency handling in order to avoid that some workers get the same task at the same time.

This commit is contained in:
Jeremie Dokime
2014-01-13 15:17:58 +01:00
parent 200a953849
commit 3f200c245c

View File

@@ -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