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 | |
| 8 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
| 9 | 8 |
| 10 from model import wf_analysis_status | 9 from common import appengine_util |
| 10 from common import constants | |
| 11 from model import analysis_status | |
| 11 from model.wf_try_job import WfTryJob | 12 from model.wf_try_job import WfTryJob |
| 12 from waterfall import swarming_tasks_to_try_job_pipeline | 13 from waterfall import swarming_tasks_to_try_job_pipeline |
| 13 from waterfall import waterfall_config | 14 from waterfall import waterfall_config |
| 14 from waterfall.try_job_type import TryJobType | 15 from waterfall.try_job_type import TryJobType |
| 15 | 16 |
| 16 | 17 |
| 17 # TODO(chanli): Need to figure out why try-job-queue doesn't work. | |
|
lijeffrey
2016/04/07 02:57:30
Does this comment still apply? If so maybe mve thi
stgao
2016/04/07 04:46:04
No. The problem was already fixed.
| |
| 18 TRY_JOB_PIPELINE_QUEUE_NAME = 'build-failure-analysis-queue' | |
| 19 | |
| 20 | |
| 21 def _CheckFailureForTryJobKey( | 18 def _CheckFailureForTryJobKey( |
| 22 master_name, builder_name, build_number, | 19 master_name, builder_name, build_number, |
| 23 failure_result_map, failed_step_or_test, failure): | 20 failure_result_map, failed_step_or_test, failure): |
| 24 """Compares the current_failure and first_failure for each failed_step/test. | 21 """Compares the current_failure and first_failure for each failed_step/test. |
| 25 | 22 |
| 26 If equal, a new try_job needs to start; | 23 If equal, a new try_job needs to start; |
| 27 If not, apply the key of the first_failure's try_job to this failure. | 24 If not, apply the key of the first_failure's try_job to this failure. |
| 28 """ | 25 """ |
| 29 # TODO(chanli): Need to compare failures across builders | 26 # TODO(chanli): Need to compare failures across builders |
| 30 # after the grouping of failures is implemented. | 27 # after the grouping of failures is implemented. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 _CheckIfNeedNewTryJobForTestFailure( | 95 _CheckIfNeedNewTryJobForTestFailure( |
| 99 'step', master_name, builder_name, build_number, failure_result_map, | 96 'step', master_name, builder_name, build_number, failure_result_map, |
| 100 failed_steps)) | 97 failed_steps)) |
| 101 | 98 |
| 102 if need_new_try_job: | 99 if need_new_try_job: |
| 103 try_job = WfTryJob.Get( | 100 try_job = WfTryJob.Get( |
| 104 master_name, builder_name, build_number) | 101 master_name, builder_name, build_number) |
| 105 | 102 |
| 106 if try_job: | 103 if try_job: |
| 107 if try_job.failed: | 104 if try_job.failed: |
| 108 try_job.status = wf_analysis_status.PENDING | 105 try_job.status = analysis_status.PENDING |
| 109 try_job.put() | 106 try_job.put() |
| 110 else: | 107 else: |
| 111 need_new_try_job = False | 108 need_new_try_job = False |
| 112 else: | 109 else: |
| 113 try_job = WfTryJob.Create( | 110 try_job = WfTryJob.Create( |
| 114 master_name, builder_name, build_number) | 111 master_name, builder_name, build_number) |
| 115 try_job.put() | 112 try_job.put() |
| 116 | 113 |
| 117 return need_new_try_job, last_pass, try_job_type, targeted_tests | 114 return need_new_try_job, last_pass, try_job_type, targeted_tests |
| 118 | 115 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 if try_job_type == TryJobType.COMPILE else None) | 161 if try_job_type == TryJobType.COMPILE else None) |
| 165 | 162 |
| 166 pipeline = ( | 163 pipeline = ( |
| 167 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( | 164 swarming_tasks_to_try_job_pipeline.SwarmingTasksToTryJobPipeline( |
| 168 master_name, builder_name, build_number, | 165 master_name, builder_name, build_number, |
| 169 builds[str(last_pass)]['chromium_revision'], | 166 builds[str(last_pass)]['chromium_revision'], |
| 170 builds[str(build_number)]['chromium_revision'], | 167 builds[str(build_number)]['chromium_revision'], |
| 171 builds[str(build_number)]['blame_list'], | 168 builds[str(build_number)]['blame_list'], |
| 172 try_job_type, compile_targets, targeted_tests)) | 169 try_job_type, compile_targets, targeted_tests)) |
| 173 | 170 |
| 174 pipeline.target = ( | 171 pipeline.target = appengine_util.GetTargetNameForModule( |
| 175 '%s.build-failure-analysis' % modules.get_current_version_name()) | 172 constants.WATERFALL_BACKEND) |
| 176 pipeline.start( | 173 pipeline.start(queue_name=constants.WATERFALL_TRY_JOB_QUEUE) |
| 177 queue_name=TRY_JOB_PIPELINE_QUEUE_NAME) | |
| 178 | 174 |
| 179 if try_job_type == TryJobType.TEST: # pragma: no cover | 175 if try_job_type == TryJobType.TEST: # pragma: no cover |
| 180 logging_str = ( | 176 logging_str = ( |
| 181 'Swarming task was scheduled for build %s, %s, %s: %s because of' | 177 'Swarming task was scheduled for build %s, %s, %s: %s because of' |
| 182 ' %s failure. A try job may be triggered if some reliable failure' | 178 ' %s failure. A try job may be triggered if some reliable failure' |
| 183 ' is detected in the task.') % ( | 179 ' is detected in the task.') % ( |
| 184 master_name, builder_name, build_number, | 180 master_name, builder_name, build_number, |
| 185 pipeline.pipeline_status_path, try_job_type) | 181 pipeline.pipeline_status_path, try_job_type) |
| 186 else: # pragma: no cover | 182 else: # pragma: no cover |
| 187 logging_str = ( | 183 logging_str = ( |
| 188 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 184 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 189 'failure.') % ( | 185 'failure.') % ( |
| 190 master_name, builder_name, build_number, | 186 master_name, builder_name, build_number, |
| 191 pipeline.pipeline_status_path, try_job_type) | 187 pipeline.pipeline_status_path, try_job_type) |
| 192 logging.info(logging_str) | 188 logging.info(logging_str) |
| 193 | 189 |
| 194 return failure_result_map | 190 return failure_result_map |
| OLD | NEW |