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

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: Use culprits directly if returned from recipe. 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 # For link failures, we pass the executable targets directly to try-job, and 128 # For link failures, we pass the executable targets directly to try-job, and
129 # there is no 'source' for link failures. 129 # there is no 'source' for link failures.
130 # For compile failures, only pass the object files as the compile targets 130 # For compile failures, only pass the object files as the compile targets
131 # for the bots that we use strict regex to extract such information. 131 # for the bots that we use strict regex to extract such information.
132 if not source_target.get('source') or strict_regex: 132 if not source_target.get('source') or strict_regex:
133 compile_targets.append(source_target.get('target')) 133 compile_targets.append(source_target.get('target'))
134 134
135 return compile_targets 135 return compile_targets
136 136
137 137
138 def _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result): 138 def _GetSuspectsFromHeuristicResult(heuristic_result):
139 suspected_revisions = [] 139 suspected_revisions = set()
140 if not heuristic_result: 140 if not heuristic_result:
141 return suspected_revisions 141 return list(suspected_revisions)
142 for failure in heuristic_result.get('failures', []): 142 for failure in heuristic_result.get('failures', []):
143 if failure['step_name'] == constants.COMPILE_STEP_NAME: 143 for cl in failure['suspected_cls']:
144 suspected_revisions = [c['revision'] for c in failure['suspected_cls']] 144 suspected_revisions.add(cl['revision'])
145 return suspected_revisions 145 return list(suspected_revisions)
146 146
147 147
148 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): 148 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result):
149 master_name = failure_info['master_name'] 149 master_name = failure_info['master_name']
150 builder_name = failure_info['builder_name'] 150 builder_name = failure_info['builder_name']
151 build_number = failure_info['build_number'] 151 build_number = failure_info['build_number']
152 failed_steps = failure_info.get('failed_steps', []) 152 failed_steps = failure_info.get('failed_steps', [])
153 builds = failure_info.get('builds', {}) 153 builds = failure_info.get('builds', {})
154 154
155 tryserver_mastername, tryserver_buildername = ( 155 tryserver_mastername, tryserver_buildername = (
(...skipping 10 matching lines...) Expand all
166 166
167 failure_result_map = {} 167 failure_result_map = {}
168 need_new_try_job, last_pass, try_job_type, targeted_tests = ( 168 need_new_try_job, last_pass, try_job_type, targeted_tests = (
169 _NeedANewTryJob(master_name, builder_name, build_number, 169 _NeedANewTryJob(master_name, builder_name, build_number,
170 failed_steps, failure_result_map)) 170 failed_steps, failure_result_map))
171 171
172 if need_new_try_job: 172 if need_new_try_job:
173 compile_targets = (_GetFailedTargetsFromSignals( 173 compile_targets = (_GetFailedTargetsFromSignals(
174 signals, master_name, builder_name) 174 signals, master_name, builder_name)
175 if try_job_type == TryJobType.COMPILE else None) 175 if try_job_type == TryJobType.COMPILE else None)
176 suspected_revisions = ( 176 suspected_revisions = _GetSuspectsFromHeuristicResult(heuristic_result)
177 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result)
178 if try_job_type == TryJobType.COMPILE else None)
179 177
180 pipeline = ( 178 pipeline = (
181 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( 179 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline(
182 master_name, builder_name, build_number, 180 master_name, builder_name, build_number,
183 builds[str(last_pass)]['chromium_revision'], 181 builds[str(last_pass)]['chromium_revision'],
184 builds[str(build_number)]['chromium_revision'], 182 builds[str(build_number)]['chromium_revision'],
185 builds[str(build_number)]['blame_list'], 183 builds[str(build_number)]['blame_list'],
186 try_job_type, compile_targets, targeted_tests, suspected_revisions)) 184 try_job_type, compile_targets, targeted_tests, suspected_revisions))
187 185
188 pipeline.target = appengine_util.GetTargetNameForModule( 186 pipeline.target = appengine_util.GetTargetNameForModule(
189 constants.WATERFALL_BACKEND) 187 constants.WATERFALL_BACKEND)
190 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) 188 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE)
191 189
192 if try_job_type == TryJobType.TEST: # pragma: no cover 190 if try_job_type == TryJobType.TEST: # pragma: no cover
193 logging_str = ( 191 logging_str = (
194 'Trying to schedule swarming task(s) for build %s, %s, %s: %s' 192 'Trying to schedule swarming task(s) for build %s, %s, %s: %s'
195 ' because of %s failure. A try job may be triggered if some reliable' 193 ' because of %s failure. A try job may be triggered if some reliable'
196 ' failure is detected in task(s).') % ( 194 ' failure is detected in task(s).') % (
197 master_name, builder_name, build_number, 195 master_name, builder_name, build_number,
198 pipeline.pipeline_status_path, try_job_type) 196 pipeline.pipeline_status_path, try_job_type)
199 else: # pragma: no cover 197 else: # pragma: no cover
200 logging_str = ( 198 logging_str = (
201 'Try job was scheduled for build %s, %s, %s: %s because of %s ' 199 'Try job was scheduled for build %s, %s, %s: %s because of %s '
202 'failure.') % ( 200 'failure.') % (
203 master_name, builder_name, build_number, 201 master_name, builder_name, build_number,
204 pipeline.pipeline_status_path, try_job_type) 202 pipeline.pipeline_status_path, try_job_type)
205 logging.info(logging_str) 203 logging.info(logging_str)
206 204
207 return failure_result_map 205 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