| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from common.pipeline_wrapper import BasePipeline | |
| 6 from model import analysis_status | |
| 7 from model.wf_try_job import WfTryJob | |
| 8 from waterfall.identify_try_job_culprit_pipeline import ( | |
| 9 IdentifyTryJobCulpritPipeline) | |
| 10 from waterfall.monitor_try_job_pipeline import MonitorTryJobPipeline | |
| 11 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline | |
| 12 | |
| 13 | |
| 14 class TryJobPipeline(BasePipeline): | |
| 15 """Root pipeline to start a try job on current build.""" | |
| 16 | |
| 17 def __init__( | |
| 18 self, master_name, builder_name, build_number, | |
| 19 good_revision, bad_revision, blame_list, try_job_type, | |
| 20 compile_targets=None, targeted_tests=None, suspected_revisions=None): | |
| 21 super(TryJobPipeline, self).__init__( | |
| 22 master_name, builder_name, build_number, good_revision, bad_revision, | |
| 23 blame_list, try_job_type, compile_targets, targeted_tests, | |
| 24 suspected_revisions) | |
| 25 self.master_name = master_name | |
| 26 self.builder_name = builder_name | |
| 27 self.build_number = build_number | |
| 28 | |
| 29 def _LogUnexpectedAbort(self, was_aborted): | |
| 30 """Marks the WfTryJob status as error, indicating that it was aborted. | |
| 31 | |
| 32 Args: | |
| 33 was_aborted (bool): True if the pipeline was aborted due to some error | |
| 34 or exception, otherwise False. | |
| 35 """ | |
| 36 if was_aborted: | |
| 37 try_job_result = WfTryJob.Get( | |
| 38 self.master_name, self.builder_name, self.build_number) | |
| 39 if try_job_result: # In case the result is deleted manually. | |
| 40 try_job_result.status = analysis_status.ERROR | |
| 41 try_job_result.put() | |
| 42 | |
| 43 def finalized(self): | |
| 44 """Finalizes this Pipeline after execution.""" | |
| 45 self._LogUnexpectedAbort(self.was_aborted) | |
| 46 | |
| 47 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 48 def run( | |
| 49 self, master_name, builder_name, build_number, good_revision, | |
| 50 bad_revision, blame_list, try_job_type, compile_targets, targeted_tests, | |
| 51 suspected_revisions): | |
| 52 try_job_id = yield ScheduleTryJobPipeline( | |
| 53 master_name, builder_name, build_number, good_revision, bad_revision, | |
| 54 try_job_type, compile_targets, targeted_tests, suspected_revisions) | |
| 55 try_job_result = yield MonitorTryJobPipeline( | |
| 56 master_name, builder_name, build_number, try_job_type, try_job_id) | |
| 57 yield IdentifyTryJobCulpritPipeline( | |
| 58 master_name, builder_name, build_number, blame_list, try_job_type, | |
| 59 try_job_id, try_job_result) | |
| OLD | NEW |