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

Side by Side Diff: appengine/findit/waterfall/try_job_util.py

Issue 1999653003: [Findit] Bailing out if build data is too old and moving relevant settings to config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments 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 unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime
5 import logging 6 import logging
6 7
7 from google.appengine.ext import ndb 8 from google.appengine.ext import ndb
8 9
9 from common import appengine_util 10 from common import appengine_util
10 from common import constants 11 from common import constants
11 from common.waterfall import failure_type 12 from common.waterfall import failure_type
12 from model import analysis_status 13 from model import analysis_status
14 from model.wf_build import WfBuild
13 from model.wf_try_job import WfTryJob 15 from model.wf_try_job import WfTryJob
14 from waterfall import swarming_tasks_to_try_job_pipeline 16 from waterfall import swarming_tasks_to_try_job_pipeline
15 from waterfall import waterfall_config 17 from waterfall import waterfall_config
16 from waterfall.try_job_type import TryJobType 18 from waterfall.try_job_type import TryJobType
17 19
18 20
19 def _CheckFailureForTryJobKey( 21 def _CheckFailureForTryJobKey(
20 master_name, builder_name, build_number, 22 master_name, builder_name, build_number,
21 failure_result_map, failed_step_or_test, failure): 23 failure_result_map, failed_step_or_test, failure):
22 """Compares the current_failure and first_failure for each failed_step/test. 24 """Compares the current_failure and first_failure for each failed_step/test.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return list(suspected_revisions) 147 return list(suspected_revisions)
146 148
147 149
148 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): 150 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result):
149 master_name = failure_info['master_name'] 151 master_name = failure_info['master_name']
150 builder_name = failure_info['builder_name'] 152 builder_name = failure_info['builder_name']
151 build_number = failure_info['build_number'] 153 build_number = failure_info['build_number']
152 failed_steps = failure_info.get('failed_steps', []) 154 failed_steps = failure_info.get('failed_steps', [])
153 builds = failure_info.get('builds', {}) 155 builds = failure_info.get('builds', {})
154 156
157 # Bail out if the build data's timestamp is more than 24 hours old to
158 # avoid using outdated revisions. TODO(lijeffrey): This will also disallow
159 # manually triggering try jobs more than a day old using build_completed=1.
160 # Need to implement a flag to force try jobs regardless of timestamp.
161 build = WfBuild.Get(master_name, builder_name, build_number)
162 if (datetime.utcnow() - build.start_time).days > 0:
stgao 2016/05/21 04:26:41 Move the check to a separate function, and it coul
lijeffrey 2016/05/21 09:02:52 Done.
163 logging.error(
164 'Build time is more than 24 hours old. Try job will not be triggered.')
165 return {}
166
155 tryserver_mastername, tryserver_buildername = ( 167 tryserver_mastername, tryserver_buildername = (
156 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) 168 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name))
157 169
158 if not tryserver_mastername or not tryserver_buildername: 170 if not tryserver_mastername or not tryserver_buildername:
159 logging.info('%s, %s is not supported yet.', master_name, builder_name) 171 logging.info('%s, %s is not supported yet.', master_name, builder_name)
160 return {} 172 return {}
161 elif (failure_info['failure_type'] == failure_type.TEST and 173 elif (failure_info['failure_type'] == failure_type.TEST and
162 waterfall_config.ShouldSkipTestTryJobs(master_name, builder_name)): 174 waterfall_config.ShouldSkipTestTryJobs(master_name, builder_name)):
163 logging.info('Test try jobs on %s, %s are not supported yet.', 175 logging.info('Test try jobs on %s, %s are not supported yet.',
164 master_name, builder_name) 176 master_name, builder_name)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 pipeline.pipeline_status_path, try_job_type) 208 pipeline.pipeline_status_path, try_job_type)
197 else: # pragma: no cover 209 else: # pragma: no cover
198 logging_str = ( 210 logging_str = (
199 'Try job was scheduled for build %s, %s, %s: %s because of %s ' 211 'Try job was scheduled for build %s, %s, %s: %s because of %s '
200 'failure.') % ( 212 'failure.') % (
201 master_name, builder_name, build_number, 213 master_name, builder_name, build_number,
202 pipeline.pipeline_status_path, try_job_type) 214 pipeline.pipeline_status_path, try_job_type)
203 logging.info(logging_str) 215 logging.info(logging_str)
204 216
205 return failure_result_map 217 return failure_result_map
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698