| OLD | NEW |
| 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 Loading... |
| 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 = [] |
| 137 if not heuristic_result: | 137 if not heuristic_result: |
| 138 return suspected_revisions | 138 return 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 suspected_revisions = [c['revision'] for c in failure['suspected_cls']] |
| 141 suspected_revisions = [c['revision'] for c in failure['suspected_cls']] | 141 return list(set(suspected_revisions)) |
| 142 return suspected_revisions | |
| 143 | 142 |
| 144 | 143 |
| 145 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): | 144 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): |
| 146 master_name = failure_info['master_name'] | 145 master_name = failure_info['master_name'] |
| 147 builder_name = failure_info['builder_name'] | 146 builder_name = failure_info['builder_name'] |
| 148 build_number = failure_info['build_number'] | 147 build_number = failure_info['build_number'] |
| 149 failed_steps = failure_info.get('failed_steps', []) | 148 failed_steps = failure_info.get('failed_steps', []) |
| 150 builds = failure_info.get('builds', {}) | 149 builds = failure_info.get('builds', {}) |
| 151 | 150 |
| 152 tryserver_mastername, tryserver_buildername = ( | 151 tryserver_mastername, tryserver_buildername = ( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 163 | 162 |
| 164 failure_result_map = {} | 163 failure_result_map = {} |
| 165 need_new_try_job, last_pass, try_job_type, targeted_tests = ( | 164 need_new_try_job, last_pass, try_job_type, targeted_tests = ( |
| 166 _NeedANewTryJob(master_name, builder_name, build_number, | 165 _NeedANewTryJob(master_name, builder_name, build_number, |
| 167 failed_steps, failure_result_map)) | 166 failed_steps, failure_result_map)) |
| 168 | 167 |
| 169 if need_new_try_job: | 168 if need_new_try_job: |
| 170 compile_targets = (_GetFailedTargetsFromSignals( | 169 compile_targets = (_GetFailedTargetsFromSignals( |
| 171 signals, master_name, builder_name) | 170 signals, master_name, builder_name) |
| 172 if try_job_type == TryJobType.COMPILE else None) | 171 if try_job_type == TryJobType.COMPILE else None) |
| 173 suspected_revisions = ( | 172 suspected_revisions = _GetSuspectsFromHeuristicResult(heuristic_result) |
| 174 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result) | |
| 175 if try_job_type == TryJobType.COMPILE else None) | |
| 176 | 173 |
| 177 pipeline = ( | 174 pipeline = ( |
| 178 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( | 175 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( |
| 179 master_name, builder_name, build_number, | 176 master_name, builder_name, build_number, |
| 180 builds[str(last_pass)]['chromium_revision'], | 177 builds[str(last_pass)]['chromium_revision'], |
| 181 builds[str(build_number)]['chromium_revision'], | 178 builds[str(build_number)]['chromium_revision'], |
| 182 builds[str(build_number)]['blame_list'], | 179 builds[str(build_number)]['blame_list'], |
| 183 try_job_type, compile_targets, targeted_tests, suspected_revisions)) | 180 try_job_type, compile_targets, targeted_tests, suspected_revisions)) |
| 184 | 181 |
| 185 pipeline.target = appengine_util.GetTargetNameForModule( | 182 pipeline.target = appengine_util.GetTargetNameForModule( |
| 186 constants.WATERFALL_BACKEND) | 183 constants.WATERFALL_BACKEND) |
| 187 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) | 184 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) |
| 188 | 185 |
| 189 if try_job_type == TryJobType.TEST: # pragma: no cover | 186 if try_job_type == TryJobType.TEST: # pragma: no cover |
| 190 logging_str = ( | 187 logging_str = ( |
| 191 'Trying to schedule swarming task(s) for build %s, %s, %s: %s' | 188 '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' | 189 ' because of %s failure. A try job may be triggered if some reliable' |
| 193 ' failure is detected in task(s).') % ( | 190 ' failure is detected in task(s).') % ( |
| 194 master_name, builder_name, build_number, | 191 master_name, builder_name, build_number, |
| 195 pipeline.pipeline_status_path, try_job_type) | 192 pipeline.pipeline_status_path, try_job_type) |
| 196 else: # pragma: no cover | 193 else: # pragma: no cover |
| 197 logging_str = ( | 194 logging_str = ( |
| 198 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 195 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 199 'failure.') % ( | 196 'failure.') % ( |
| 200 master_name, builder_name, build_number, | 197 master_name, builder_name, build_number, |
| 201 pipeline.pipeline_status_path, try_job_type) | 198 pipeline.pipeline_status_path, try_job_type) |
| 202 logging.info(logging_str) | 199 logging.info(logging_str) |
| 203 | 200 |
| 204 return failure_result_map | 201 return failure_result_map |
| OLD | NEW |