From d5d550d2461fb51d687a339bfc04b1b299b033f2 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Tue, 26 Apr 2016 11:14:05 +0200 Subject: [PATCH] [backend] Improved scheduling and current load calculation --- beat/web/backend/schedule.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/beat/web/backend/schedule.py b/beat/web/backend/schedule.py index dd3c0e097..dc0236d20 100644 --- a/beat/web/backend/schedule.py +++ b/beat/web/backend/schedule.py @@ -176,6 +176,11 @@ def schedule(): (taking into consideration blocking as executed on step 3) and leave the job split on the list if there is a free slot, otherwise remove it. + + Returns: + + list: The list of splits assigned at this scheduling iteration + ''' # updates jobs with split errors, cancel experiments if problems occur @@ -201,6 +206,8 @@ def schedule(): if availability <= 0: continue whitelist[worker] = availability + assigned_splits = [] + for batch in splits_to_consider: if not batch: continue #empty list @@ -217,6 +224,7 @@ def schedule(): if avail >= required_cores: logger.info("Assigning `%s' to worker `%s'", split, c) split.schedule(c) #assign job split to worker + assigned_splits.append(split) whitelist[c] -= required_cores logger.debug("`%s' cores available: %d", c, whitelist[c]) assigned = True @@ -231,6 +239,8 @@ def schedule(): job, c0) del whitelist[c0] + return assigned_splits + def process(split, environments, cpulimit=None): '''Process assigned job splits using beat.core -- GitLab