| 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 # For link failures, we pass the executable targets directly to try-job, and |
| 128 # Currently only link failures on linux are supported. Add support for | 130 # there is no 'source' for link failures. |
| 129 # compile failures and other platforms as well. | 131 # For compile failures, only pass the object files as the compile targets |
| 130 if not source_target.get('source'): | 132 # for the bots that we use strict regex to extract such information. |
| 133 if not source_target.get('source') or strict_regex: |
| 131 compile_targets.append(source_target.get('target')) | 134 compile_targets.append(source_target.get('target')) |
| 132 | 135 |
| 133 return compile_targets | 136 return compile_targets |
| 134 | 137 |
| 135 | 138 |
| 136 def ScheduleTryJobIfNeeded(failure_info, signals=None, build_completed=False): | 139 def ScheduleTryJobIfNeeded(failure_info, signals=None, build_completed=False): |
| 137 # Do not schedule try-jobs or Swarming tasks until the build is completed. | 140 # Do not schedule try-jobs or Swarming tasks until the build is completed. |
| 138 if not build_completed: | 141 if not build_completed: |
| 139 return {} | 142 return {} |
| 140 | 143 |
| 141 master_name = failure_info['master_name'] | 144 master_name = failure_info['master_name'] |
| 142 builder_name = failure_info['builder_name'] | 145 builder_name = failure_info['builder_name'] |
| 143 build_number = failure_info['build_number'] | 146 build_number = failure_info['build_number'] |
| 144 failed_steps = failure_info.get('failed_steps', []) | 147 failed_steps = failure_info.get('failed_steps', []) |
| 145 builds = failure_info.get('builds', {}) | 148 builds = failure_info.get('builds', {}) |
| 146 | 149 |
| 147 tryserver_mastername, tryserver_buildername = ( | 150 tryserver_mastername, tryserver_buildername = ( |
| 148 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) | 151 waterfall_config.GetTrybotForWaterfallBuilder(master_name, builder_name)) |
| 149 if not tryserver_mastername or not tryserver_buildername: | 152 if not tryserver_mastername or not tryserver_buildername: |
| 150 logging.info('%s, %s is not supported yet.', master_name, builder_name) | 153 logging.info('%s, %s is not supported yet.', master_name, builder_name) |
| 151 return {} | 154 return {} |
| 152 | 155 |
| 153 failure_result_map = {} | 156 failure_result_map = {} |
| 154 need_new_try_job, last_pass, try_job_type, targeted_tests = ( | 157 need_new_try_job, last_pass, try_job_type, targeted_tests = ( |
| 155 _NeedANewTryJob(master_name, builder_name, build_number, | 158 _NeedANewTryJob(master_name, builder_name, build_number, |
| 156 failed_steps, failure_result_map)) | 159 failed_steps, failure_result_map)) |
| 157 | 160 |
| 158 if need_new_try_job: | 161 if need_new_try_job: |
| 159 compile_targets = (_GetFailedTargetsFromSignals(signals) | 162 compile_targets = (_GetFailedTargetsFromSignals( |
| 163 signals, master_name, builder_name) |
| 160 if try_job_type == TryJobType.COMPILE else None) | 164 if try_job_type == TryJobType.COMPILE else None) |
| 161 | 165 |
| 162 pipeline = ( | 166 pipeline = ( |
| 163 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( | 167 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( |
| 164 master_name, builder_name, build_number, | 168 master_name, builder_name, build_number, |
| 165 builds[str(last_pass)]['chromium_revision'], | 169 builds[str(last_pass)]['chromium_revision'], |
| 166 builds[str(build_number)]['chromium_revision'], | 170 builds[str(build_number)]['chromium_revision'], |
| 167 builds[str(build_number)]['blame_list'], | 171 builds[str(build_number)]['blame_list'], |
| 168 try_job_type, compile_targets, targeted_tests)) | 172 try_job_type, compile_targets, targeted_tests)) |
| 169 | 173 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 181 pipeline.pipeline_status_path, try_job_type) | 185 pipeline.pipeline_status_path, try_job_type) |
| 182 else: # pragma: no cover | 186 else: # pragma: no cover |
| 183 logging_str = ( | 187 logging_str = ( |
| 184 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 188 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 185 'failure.') % ( | 189 'failure.') % ( |
| 186 master_name, builder_name, build_number, | 190 master_name, builder_name, build_number, |
| 187 pipeline.pipeline_status_path, try_job_type) | 191 pipeline.pipeline_status_path, try_job_type) |
| 188 logging.info(logging_str) | 192 logging.info(logging_str) |
| 189 | 193 |
| 190 return failure_result_map | 194 return failure_result_map |
| OLD | NEW |