aboutsummaryrefslogtreecommitdiff
path: root/cros_utils
diff options
context:
space:
mode:
authorYunlian Jiang <yunlian@google.com>2016-12-12 11:07:40 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-12 14:56:39 -0800
commite84ea3d3e9fbe92d9854a85d67ab01fb488781c7 (patch)
treec6785d74b190ca3883102463cc036ee87f4fc72d /cros_utils
parent7a6bb17630ea86f12c1045c2c47339b02e79bdc2 (diff)
downloadtoolchain-utils-e84ea3d3e9fbe92d9854a85d67ab01fb488781c7.tar.gz
toolchain-utils: add build link to daily trybot logs.
This adds build link to daily trybot logs. It also waits 2 hours before polling the building status to trybot. BUG=chromium:673419 TEST=The build link is added in the log. Change-Id: I8fc0ea413ee0f40b398d6eb80c3308c5a1e7d793 Reviewed-on: https://chrome-internal-review.googlesource.com/311042 Commit-Ready: Yunlian Jiang <yunlian@google.com> Tested-by: Yunlian Jiang <yunlian@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'cros_utils')
-rw-r--r--cros_utils/buildbot_utils.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/cros_utils/buildbot_utils.py b/cros_utils/buildbot_utils.py
index 4cca08ed..fa97bd15 100644
--- a/cros_utils/buildbot_utils.py
+++ b/cros_utils/buildbot_utils.py
@@ -18,6 +18,7 @@ from cros_utils import command_executer
from cros_utils import logger
from cros_utils import buildbot_json
+INITIAL_SLEEP_TIME = 7200 # 2 hours; wait time before polling buildbot.
SLEEP_TIME = 600 # 10 minutes; time between polling of buildbot.
TIME_OUT = 28800 # Decide the build is dead or will never finish
# after this time (8 hours).
@@ -243,10 +244,6 @@ def GetTrybotImage(chromeos_root,
logger.GetLogger().LogFatal('Error occurred while launching trybot job: '
'%s' % command)
- if async:
- # Do not wait for trybot job to finish; return immediately
- return 0
-
os.chdir(base_dir)
build_id = 0
@@ -264,6 +261,7 @@ def GetTrybotImage(chromeos_root,
# logs.
pending_time = SLEEP_TIME
running_time = 0
+ long_slept = False
while not done:
done = True
build_info = GetBuildInfo(base_dir, build)
@@ -293,8 +291,19 @@ def GetTrybotImage(chromeos_root,
# still have to wait for the buildbot job to finish running
# however.
pending = False
+ build_id = data_dict['number']
+
+ if async:
+ # Do not wait for trybot job to finish; return immediately
+ return build_id, " "
+
+ if not long_slept:
+ # The trybot generally takes more than 2 hours to finish.
+ # Wait two hours before polling the status.
+ long_slept = True
+ time.sleep(INITIAL_SLEEP_TIME)
+ pending_time += INITIAL_SLEEP_TIME
if True == data_dict['finished']:
- build_id = data_dict['number']
build_status = data_dict['results']
else:
done = False
@@ -334,7 +343,7 @@ def GetTrybotImage(chromeos_root,
logger.GetLogger().LogOutput("trybot_image is '%s'" % trybot_image)
logger.GetLogger().LogOutput('build_status is %d' % build_status)
- return trybot_image
+ return build_id, trybot_image
def DoesImageExist(chromeos_root, build):