Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 145 |
| 146 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): | 146 def ScheduleTryJobIfNeeded(failure_info, signals, heuristic_result): |
| 147 master_name = failure_info['master_name'] | 147 master_name = failure_info['master_name'] |
| 148 builder_name = failure_info['builder_name'] | 148 builder_name = failure_info['builder_name'] |
| 149 build_number = failure_info['build_number'] | 149 build_number = failure_info['build_number'] |
| 150 failed_steps = failure_info.get('failed_steps', []) | 150 failed_steps = failure_info.get('failed_steps', []) |
| 151 builds = failure_info.get('builds', {}) | 151 builds = failure_info.get('builds', {}) |
| 152 | 152 |
| 153 tryserver_mastername, tryserver_buildername = ( | 153 tryserver_mastername, tryserver_buildername = ( |
| 154 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) | 154 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) |
| 155 | |
| 155 if not tryserver_mastername or not tryserver_buildername: | 156 if not tryserver_mastername or not tryserver_buildername: |
| 156 logging.info('%s, %s is not supported yet.', master_name, builder_name) | 157 logging.info('%s, %s is not supported yet.', master_name, builder_name) |
| 157 return {} | 158 return {} |
| 158 | 159 |
| 159 failure_result_map = {} | 160 failure_result_map = {} |
| 160 need_new_try_job, last_pass, try_job_type, targeted_tests = ( | 161 need_new_try_job, last_pass, try_job_type, targeted_tests = ( |
| 161 _NeedANewTryJob(master_name, builder_name, build_number, | 162 _NeedANewTryJob(master_name, builder_name, build_number, |
|
stgao
2016/04/16 06:33:15
If _NeedANewTryJob is run, a TryJob entity is crea
lijeffrey
2016/04/18 21:40:41
Addressed in https://codereview.chromium.org/18980
| |
| 162 failed_steps, failure_result_map)) | 163 failed_steps, failure_result_map)) |
| 163 | 164 |
| 165 if (try_job_type == TryJobType.TEST and | |
| 166 waterfall_config.ShouldSkipTestTryJobs(master_name, builder_name)): | |
| 167 logging.info('Test try jobs on %s, %s are not supported yet.', | |
| 168 master_name, builder_name) | |
| 169 return {} | |
| 170 | |
| 164 if need_new_try_job: | 171 if need_new_try_job: |
| 165 compile_targets = (_GetFailedTargetsFromSignals( | 172 compile_targets = (_GetFailedTargetsFromSignals( |
| 166 signals, master_name, builder_name) | 173 signals, master_name, builder_name) |
| 167 if try_job_type == TryJobType.COMPILE else None) | 174 if try_job_type == TryJobType.COMPILE else None) |
| 168 suspected_revisions = ( | 175 suspected_revisions = ( |
| 169 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result) | 176 _GetSuspectsForCompileFailureFromHeuristicResult(heuristic_result) |
| 170 if try_job_type == TryJobType.COMPILE else None) | 177 if try_job_type == TryJobType.COMPILE else None) |
| 171 | 178 |
| 172 pipeline = ( | 179 pipeline = ( |
| 173 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( | 180 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( |
| 174 master_name, builder_name, build_number, | 181 master_name, builder_name, build_number, |
| 175 builds[str(last_pass)]['chromium_revision'], | 182 builds[str(last_pass)]['chromium_revision'], |
| 176 builds[str(build_number)]['chromium_revision'], | 183 builds[str(build_number)]['chromium_revision'], |
| 177 builds[str(build_number)]['blame_list'], | 184 builds[str(build_number)]['blame_list'], |
| 178 try_job_type, compile_targets, targeted_tests, suspected_revisions)) | 185 try_job_type, compile_targets, targeted_tests, suspected_revisions)) |
| 179 | 186 |
| 180 pipeline.target = appengine_util.GetTargetNameForModule( | 187 pipeline.target = appengine_util.GetTargetNameForModule( |
| 181 constants.WATERFALL_BACKEND) | 188 constants.WATERFALL_BACKEND) |
| 182 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) | 189 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) |
| 183 | 190 |
| 184 if try_job_type == TryJobType.TEST: # pragma: no cover | 191 if try_job_type == TryJobType.TEST: # pragma: no cover |
| 185 logging_str = ( | 192 logging_str = ( |
| 186 'Swarming task was scheduled for build %s, %s, %s: %s because of' | 193 'Swarming task was scheduled for build %s, %s, %s: %s because of' |
| 187 ' %s failure. A try job may be triggered if some reliable failure' | 194 ' %s failure. A try job may be triggered if some reliable failure' |
| 188 ' is detected in the task.') % ( | 195 ' is detected in the task.') % ( |
| 189 master_name, builder_name, build_number, | 196 master_name, builder_name, build_number, |
| 190 pipeline.pipeline_status_path, try_job_type) | 197 pipeline.pipeline_status_path, try_job_type) |
| 191 else: # pragma: no cover | 198 else: # pragma: no cover |
| 192 logging_str = ( | 199 logging_str = ( |
| 193 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 200 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 194 'failure.') % ( | 201 'failure.') % ( |
| 195 master_name, builder_name, build_number, | 202 master_name, builder_name, build_number, |
| 196 pipeline.pipeline_status_path, try_job_type) | 203 pipeline.pipeline_status_path, try_job_type) |
| 197 logging.info(logging_str) | 204 logging.info(logging_str) |
| 198 | 205 |
| 199 return failure_result_map | 206 return failure_result_map |
| OLD | NEW |