diff options
author | Yuheng Long <yuhenglong@google.com> | 2013-07-22 13:51:17 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-07-25 17:25:37 -0700 |
commit | a5712a2c71aa665dcca808963d152228890c8364 (patch) | |
tree | 176ebb146015c9275bae9f5f66ecc761a42dacd2 /bestflags/generation.py | |
parent | fefa5c0174b32eb359eca91acebab772356a4473 (diff) | |
download | toolchain-utils-a5712a2c71aa665dcca808963d152228890c8364.tar.gz |
Add the steering stage of the framework.
BUG=None
TEST=unit testings for the pipeline stage, pipeline workers, generation and
steering.
Change-Id: Id92bcf04ee24dfbc918f59ac8d87d30ee69e47b3
Reviewed-on: https://gerrit-int.chromium.org/41454
Reviewed-by: Simon Que <sque@google.com>
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Yuheng Long <yuhenglong@google.com>
Tested-by: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags/generation.py')
-rw-r--r-- | bestflags/generation.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/bestflags/generation.py b/bestflags/generation.py index f1a63631..7f0e94a1 100644 --- a/bestflags/generation.py +++ b/bestflags/generation.py @@ -85,19 +85,26 @@ class Generation(object): Args: task: A task that has its results ready. + + Returns: + Whether the input task belongs to this generation. """ - # If there is a match. - if task in self._exe_pool: - # Remove the place holder task in this generation and store the new input - # task and its result. - self._exe_pool.remove(task) - self._exe_pool.add(task) + # If there is a match, the input task belongs to this generation. + if task not in self._exe_pool: + return False + + # Remove the place holder task in this generation and store the new input + # task and its result. + self._exe_pool.remove(task) + self._exe_pool.add(task) + + # The current generation will have one less task to wait on. + self._pending -= 1 - # The current generation will have one less task to wait on. - self._pending -= 1 + assert self._pending >= 0 - assert self._pending >= 0 + return True def Improve(self): """True if this generation has improvement over its parent generation. |