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.api import modules | 7 from google.appengine.api import modules |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from model import wf_analysis_status | 10 from model import wf_analysis_status |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 else: | 110 else: |
| 111 need_new_try_job = False | 111 need_new_try_job = False |
| 112 else: | 112 else: |
| 113 try_job = WfTryJob.Create( | 113 try_job = WfTryJob.Create( |
| 114 master_name, builder_name, build_number) | 114 master_name, builder_name, build_number) |
| 115 try_job.put() | 115 try_job.put() |
| 116 | 116 |
| 117 return need_new_try_job, last_pass, try_job_type, targeted_tests | 117 return need_new_try_job, last_pass, try_job_type, targeted_tests |
| 118 | 118 |
| 119 | 119 |
| 120 def _GetFailedTargetsFromSignals(signals): | 120 def _GetFailedTargetsFromSignals(signals, master_name, builder_name): |
| 121 compile_targets = [] | 121 compile_targets = [] |
| 122 | 122 |
| 123 if not signals or 'compile' not in signals: | 123 if not signals or 'compile' not in signals: |
| 124 return compile_targets | 124 return compile_targets |
| 125 | 125 |
| 126 strict_regex = waterfall_config.EnableStrictRegexForCompileLinkFailures( | |
| 127 master_name, builder_name) | |
| 126 for source_target in signals['compile']['failed_targets']: | 128 for source_target in signals['compile']['failed_targets']: |
| 127 # Link failures have only targets but no source. TODO(lijeffrey): | 129 # Link failures have only targets but no source. TODO(lijeffrey): |
| 128 # Currently only link failures on linux are supported. Add support for | 130 # Currently only link failures on linux are supported. Add support for |
| 129 # compile failures and other platforms as well. | 131 # compile failures and other platforms as well. |
| 130 if not source_target.get('source'): | 132 if not source_target.get('source'): |
|
lijeffrey
2016/03/15 07:12:26
nit: I think this if can be simplified to
if not
stgao
2016/03/15 18:32:21
sg. Done.
| |
| 131 compile_targets.append(source_target.get('target')) | 133 compile_targets.append(source_target.get('target')) |
| 134 elif strict_regex: | |
| 135 # Use object files as the compile targets on bots that we use strict | |
| 136 # regex to extract such information. | |
| 137 compile_targets.append(source_target.get('target')) | |
| 132 | 138 |
| 133 return compile_targets | 139 return compile_targets |
| 134 | 140 |
| 135 | 141 |
| 136 def ScheduleTryJobIfNeeded(failure_info, signals=None, build_completed=False): | 142 def ScheduleTryJobIfNeeded(failure_info, signals=None, build_completed=False): |
| 137 # Do not schedule try-jobs or Swarming tasks until the build is completed. | 143 # Do not schedule try-jobs or Swarming tasks until the build is completed. |
| 138 if not build_completed: | 144 if not build_completed: |
| 139 return {} | 145 return {} |
| 140 | 146 |
| 141 master_name = failure_info['master_name'] | 147 master_name = failure_info['master_name'] |
| 142 builder_name = failure_info['builder_name'] | 148 builder_name = failure_info['builder_name'] |
| 143 build_number = failure_info['build_number'] | 149 build_number = failure_info['build_number'] |
| 144 failed_steps = failure_info.get('failed_steps', []) | 150 failed_steps = failure_info.get('failed_steps', []) |
| 145 builds = failure_info.get('builds', {}) | 151 builds = failure_info.get('builds', {}) |
| 146 | 152 |
| 147 tryserver_mastername, tryserver_buildername = ( | 153 tryserver_mastername, tryserver_buildername = ( |
| 148 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) | 154 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) |
| 149 if not tryserver_mastername or not tryserver_buildername: | 155 if not tryserver_mastername or not tryserver_buildername: |
| 150 logging.info('%s, %s is not supported yet.', master_name, builder_name) | 156 logging.info('%s, %s is not supported yet.', master_name, builder_name) |
| 151 return {} | 157 return {} |
| 152 | 158 |
| 153 failure_result_map = {} | 159 failure_result_map = {} |
| 154 need_new_try_job, last_pass, try_job_type, targeted_tests = ( | 160 need_new_try_job, last_pass, try_job_type, targeted_tests = ( |
| 155 _NeedANewTryJob(master_name, builder_name, build_number, | 161 _NeedANewTryJob(master_name, builder_name, build_number, |
| 156 failed_steps, failure_result_map)) | 162 failed_steps, failure_result_map)) |
| 157 | 163 |
| 158 if need_new_try_job: | 164 if need_new_try_job: |
| 159 compile_targets = (_GetFailedTargetsFromSignals(signals) | 165 compile_targets = (_GetFailedTargetsFromSignals( |
| 166 signals, master_name, builder_name) | |
| 160 if try_job_type == TryJobType.COMPILE else None) | 167 if try_job_type == TryJobType.COMPILE else None) |
| 161 | 168 |
| 162 pipeline = ( | 169 pipeline = ( |
| 163 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( | 170 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( |
| 164 master_name, builder_name, build_number, | 171 master_name, builder_name, build_number, |
| 165 builds[str(last_pass)]['chromium_revision'], | 172 builds[str(last_pass)]['chromium_revision'], |
| 166 builds[str(build_number)]['chromium_revision'], | 173 builds[str(build_number)]['chromium_revision'], |
| 167 builds[str(build_number)]['blame_list'], | 174 builds[str(build_number)]['blame_list'], |
| 168 try_job_type, compile_targets, targeted_tests)) | 175 try_job_type, compile_targets, targeted_tests)) |
| 169 | 176 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 181 pipeline.pipeline_status_path, try_job_type) | 188 pipeline.pipeline_status_path, try_job_type) |
| 182 else: # pragma: no cover | 189 else: # pragma: no cover |
| 183 logging_str = ( | 190 logging_str = ( |
| 184 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 191 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 185 'failure.') % ( | 192 'failure.') % ( |
| 186 master_name, builder_name, build_number, | 193 master_name, builder_name, build_number, |
| 187 pipeline.pipeline_status_path, try_job_type) | 194 pipeline.pipeline_status_path, try_job_type) |
| 188 logging.info(logging_str) | 195 logging.info(logging_str) |
| 189 | 196 |
| 190 return failure_result_map | 197 return failure_result_map |
| OLD | NEW |