buildbot_utils: fix waiting logic in GetTrybotImage.
The problematic case is when buildbot_json.py execution fails and
the call to GetBuildInfo returns nothing (line 209). done is set
to False (line 216), and the full "if done:" block is skipped.
Unfortunately, the "if not done:" block starting at line 242 is
inside the "if done:" block (Yay Python!). This simply jumps back
to the beginning of the while loop (line 207) without sleeping for
SLEEP_TIME and without updating pending_time. Result: an infinite
loop with no delay spawning a new process on each iteration.
BUG=None
TEST=SLEEP_TIME and TIME_OUT are respected in the loop.
Change-Id: I7cc741b7a183233507968277345a079aecce9cd2
Reviewed-on: https://chrome-internal-review.googlesource.com/225252
Reviewed-by: Caroline Tice <cmtice@google.com>
Commit-Queue: Rahul Chaudhry <rahulchaudhry@google.com>
Tested-by: Rahul Chaudhry <rahulchaudhry@google.com>
diff --git a/utils/buildbot_utils.py b/utils/buildbot_utils.py
index 69db35a..c8507bf 100644
--- a/utils/buildbot_utils.py
+++ b/utils/buildbot_utils.py
@@ -239,22 +239,22 @@
else:
done = False
- if not done:
- if pending:
- logger.GetLogger().LogOutput(pending_message)
- logger.GetLogger().LogOutput("Current pending time: %d minutes." %
- (pending_time / 60))
- pending_time += SLEEP_TIME
- else:
- logger.GetLogger().LogOutput("{0} minutes passed.".format(
- running_time / 60))
- logger.GetLogger().LogOutput("Sleeping {0} seconds.".format(
- SLEEP_TIME))
- running_time += SLEEP_TIME
+ if not done:
+ if pending:
+ logger.GetLogger().LogOutput(pending_message)
+ logger.GetLogger().LogOutput("Current pending time: %d minutes." %
+ (pending_time / 60))
+ pending_time += SLEEP_TIME
+ else:
+ logger.GetLogger().LogOutput("{0} minutes passed.".format(
+ running_time / 60))
+ logger.GetLogger().LogOutput("Sleeping {0} seconds.".format(
+ SLEEP_TIME))
+ running_time += SLEEP_TIME
- time.sleep(SLEEP_TIME)
- if running_time > TIME_OUT:
- done = True
+ time.sleep(SLEEP_TIME)
+ if running_time > TIME_OUT:
+ done = True
trybot_image = FindArchiveImage(chromeos_root, build, build_id)
if not trybot_image: