Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2460)

Unified Diff: scripts/slave/recipe_modules/auto_bisect/bisector.py

Issue 2013133002: Avoid nesting steps called under waiting for x: (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Hiding changes behind optional parameter Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/auto_bisect/bisector.py
diff --git a/scripts/slave/recipe_modules/auto_bisect/bisector.py b/scripts/slave/recipe_modules/auto_bisect/bisector.py
index 82b452b91efc5648e28ff6c91e7345b5848128ee..23c69450c4cf8787885a1edb03bf6ff6b2d079a0 100644
--- a/scripts/slave/recipe_modules/auto_bisect/bisector.py
+++ b/scripts/slave/recipe_modules/auto_bisect/bisector.py
@@ -68,13 +68,15 @@ _DIRECTION_OF_IMPROVEMENT_ABORT_REASON = (
class Bisector(object):
"""This class abstracts an ongoing bisect (or n-sect) job."""
- def __init__(self, api, bisect_config, revision_class, init_revisions=True):
+ def __init__(self, api, bisect_config, revision_class, init_revisions=True,
+ **flags):
"""Initializes the state of a new bisect job from a dictionary.
Note that the initial good_rev and bad_rev MUST resolve to a commit position
in the chromium repo.
"""
super(Bisector, self).__init__()
+ self.flags = flags
self._api = api
self.result_codes = set()
self.ensure_sync_master_branch()
@@ -742,22 +744,25 @@ class Bisector(object):
for r in revision_list:
self.wait_for(r)
- def wait_for(self, revision):
+ def wait_for(self, revision, nest_check=True):
"""Waits for the revision to finish its job."""
- with self.api.m.step.nest('Waiting for ' + revision.revision_string()):
- while True:
- revision.update_status()
- if revision.in_progress:
- self.api.m.python.inline(
- 'sleeping',
- """
- import sys
- import time
- time.sleep(20*60)
- sys.exit(0)
- """)
- else:
- break
+ if nest_check and not self.flags.get(
+ 'do_not_nest_wait_for_revision'): # pragma: no cover
+ with self.api.m.step.nest('Waiting for ' + revision.revision_string()):
+ return self.wait_for(revision, nest_check=False)
+ while True:
+ revision.update_status()
+ if revision.in_progress:
+ self.api.m.python.inline(
+ 'sleeping',
+ """
+ import sys
+ import time
+ time.sleep(20*60)
+ sys.exit(0)
+ """)
+ else:
+ break
def _update_candidate_range(self):
"""Updates lkgr and fkbr (last known good/first known bad) revisions.
« no previous file with comments | « scripts/slave/recipe_modules/auto_bisect/api.py ('k') | scripts/slave/recipe_modules/auto_bisect/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698