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

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

Issue 1924823003: [Findit] Use heuristic analysis result for test try jobs(Findit side). (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address 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
« no previous file with comments | « appengine/findit/waterfall/test/try_job_util_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import logging 5 import logging
6 6
7 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
8 8
9 from common import appengine_util 9 from common import appengine_util
10 from common import constants 10 from common import constants
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 # For link failures, we pass the executable targets directly to try-job, and 125 # For link failures, we pass the executable targets directly to try-job, and
126 # there is no 'source' for link failures. 126 # there is no 'source' for link failures.
127 # For compile failures, only pass the object files as the compile targets 127 # For compile failures, only pass the object files as the compile targets
128 # for the bots that we use strict regex to extract such information. 128 # for the bots that we use strict regex to extract such information.
129 if not source_target.get('source') or strict_regex: 129 if not source_target.get('source') or strict_regex:
130 compile_targets.append(source_target.get('target')) 130 compile_targets.append(source_target.get('target'))
131 131
132 return compile_targets 132 return compile_targets
133 133
134 134
135 def _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result): 135 def _GetSuspectsFromHeuristicResult(heuristic_result):
136 suspected_revisions = [] 136 suspected_revisions = set()
137 if not heuristic_result: 137 if not heuristic_result:
138 return suspected_revisions 138 return list(suspected_revisions)
139 for failure in heuristic_result.get('failures', []): 139 for failure in heuristic_result.get('failures', []):
140 if failure['step_name'] == constants.COMPILE_STEP_NAME: 140 for cl in failure['suspected_cls']:
141 suspected_revisions = [c['revision'] for c in failure['suspected_cls']] 141 suspected_revisions.add(cl['revision'])
stgao 2016/04/28 22:25:49 Have you considered organizing suspected CLs by st
chanli 2016/04/28 22:43:18 I have thought about it. But I think the accuracy
142 return suspected_revisions 142 return list(suspected_revisions)
143 143
144 144
145 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): 145 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result):
146 master_name = failure_info['master_name'] 146 master_name = failure_info['master_name']
147 builder_name = failure_info['builder_name'] 147 builder_name = failure_info['builder_name']
148 build_number = failure_info['build_number'] 148 build_number = failure_info['build_number']
149 failed_steps = failure_info.get('failed_steps', []) 149 failed_steps = failure_info.get('failed_steps', [])
150 builds = failure_info.get('builds', {}) 150 builds = failure_info.get('builds', {})
151 151
152 tryserver_mastername, tryserver_buildername = ( 152 tryserver_mastername, tryserver_buildername = (
(...skipping 10 matching lines...) Expand all
163 163
164 failure_result_map = {} 164 failure_result_map = {}
165 need_new_try_job, last_pass, try_job_type, targeted_tests = ( 165 need_new_try_job, last_pass, try_job_type, targeted_tests = (
166 _NeedANewTryJob(master_name, builder_name, build_number, 166 _NeedANewTryJob(master_name, builder_name, build_number,
167 failed_steps, failure_result_map)) 167 failed_steps, failure_result_map))
168 168
169 if need_new_try_job: 169 if need_new_try_job:
170 compile_targets = (_GetFailedTargetsFromSignals( 170 compile_targets = (_GetFailedTargetsFromSignals(
171 signals, master_name, builder_name) 171 signals, master_name, builder_name)
172 if try_job_type == TryJobType.COMPILE else None) 172 if try_job_type == TryJobType.COMPILE else None)
173 suspected_revisions = ( 173 suspected_revisions = _GetSuspectsFromHeuristicResult(heuristic_result)
174 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result)
175 if try_job_type == TryJobType.COMPILE else None)
176 174
177 pipeline = ( 175 pipeline = (
178 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( 176 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline(
179 master_name, builder_name, build_number, 177 master_name, builder_name, build_number,
180 builds[str(last_pass)]['chromium_revision'], 178 builds[str(last_pass)]['chromium_revision'],
181 builds[str(build_number)]['chromium_revision'], 179 builds[str(build_number)]['chromium_revision'],
182 builds[str(build_number)]['blame_list'], 180 builds[str(build_number)]['blame_list'],
183 try_job_type, compile_targets, targeted_tests, suspected_revisions)) 181 try_job_type, compile_targets, targeted_tests, suspected_revisions))
184 182
185 pipeline.target = appengine_util.GetTargetNameForModule( 183 pipeline.target = appengine_util.GetTargetNameForModule(
186 constants.WATERFALL_BACKEND) 184 constants.WATERFALL_BACKEND)
187 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) 185 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE)
188 186
189 if try_job_type == TryJobType.TEST: # pragma: no cover 187 if try_job_type == TryJobType.TEST: # pragma: no cover
190 logging_str = ( 188 logging_str = (
191 'Trying to schedule swarming task(s) for build %s, %s, %s: %s' 189 'Trying to schedule swarming task(s) for build %s, %s, %s: %s'
192 ' because of %s failure. A try job may be triggered if some reliable' 190 ' because of %s failure. A try job may be triggered if some reliable'
193 ' failure is detected in task(s).') % ( 191 ' failure is detected in task(s).') % (
194 master_name, builder_name, build_number, 192 master_name, builder_name, build_number,
195 pipeline.pipeline_status_path, try_job_type) 193 pipeline.pipeline_status_path, try_job_type)
196 else: # pragma: no cover 194 else: # pragma: no cover
197 logging_str = ( 195 logging_str = (
198 'Try job was scheduled for build %s, %s, %s: %s because of %s ' 196 'Try job was scheduled for build %s, %s, %s: %s because of %s '
199 'failure.') % ( 197 'failure.') % (
200 master_name, builder_name, build_number, 198 master_name, builder_name, build_number,
201 pipeline.pipeline_status_path, try_job_type) 199 pipeline.pipeline_status_path, try_job_type)
202 logging.info(logging_str) 200 logging.info(logging_str)
203 201
204 return failure_result_map 202 return failure_result_map
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/test/try_job_util_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698