Skip to content
Snippets Groups Projects
Commit 7070608b authored by Matthieu Simon's avatar Matthieu Simon
Browse files

add different behavior if job_id is not null in dispatch_task

parent 74a32296
No related branches found
No related tags found
No related merge requests found
...@@ -169,7 +169,11 @@ class TaskApi(Resource): ...@@ -169,7 +169,11 @@ class TaskApi(Resource):
#managers = Manager.query.\ #managers = Manager.query.\
# all() # all()
managers = iter(sorted(app.config['MANAGERS'], key=lambda m : m.total_workers, reverse=True)) managers = iter(sorted(app.config['MANAGERS'], key=lambda m : m.total_workers, reverse=True))
tasks = Task.query.filter_by(status='ready').order_by(Task.priority.desc()) tasks = None
if job_id is None:
tasks = Task.query.filter_by(status='ready').order_by(Task.priority.desc())
else:
tasks = Task.query.filter_by(job_id=job_id).order_by(Task.priority.desc())
# We get the available managers # We get the available managers
m = managers.next() m = managers.next()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment