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 from common.pipeline_wrapper import BasePipeline | 5 from common.pipeline_wrapper import BasePipeline |
| 6 from common.pipeline_wrapper import pipeline | 6 from common.pipeline_wrapper import pipeline |
| 7 from common.waterfall import buildbucket_client | 7 from common.waterfall import buildbucket_client |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model.wf_try_job import WfTryJob | |
| 10 from model.wf_try_job_data import WfTryJobData | |
| 11 from waterfall import buildbot | 9 from waterfall import buildbot |
| 12 from waterfall import waterfall_config | 10 from waterfall import waterfall_config |
| 13 | 11 |
| 14 | 12 |
| 15 class ScheduleTryJobPipeline(BasePipeline): | 13 class ScheduleTryJobPipeline(BasePipeline): |
| 16 """A base pipeline for scheduling a new try job for current build.""" | 14 """A base pipeline for scheduling a new try job for current build.""" |
| 17 | 15 |
| 18 def _GetBuildProperties( | 16 def _GetBuildProperties( |
| 19 self, master_name, builder_name, build_number, good_revision, | 17 self, master_name, builder_name, build_number, good_revision, |
| 20 bad_revision, try_job_type, suspected_revisions): | 18 bad_revision, try_job_type, suspected_revisions): |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 43 tryserver_mastername, tryserver_buildername, None, properties, [], | 41 tryserver_mastername, tryserver_buildername, None, properties, [], |
| 44 additional_parameters) | 42 additional_parameters) |
| 45 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] | 43 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] |
| 46 | 44 |
| 47 if error: # pragma: no cover | 45 if error: # pragma: no cover |
| 48 raise pipeline.Retry( | 46 raise pipeline.Retry( |
| 49 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) | 47 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) |
| 50 | 48 |
| 51 return build.id | 49 return build.id |
| 52 | 50 |
| 53 def _CreateTryJobData( | |
| 54 self, build_id, master_name, builder_name, build_number, try_job_type, | |
| 55 has_compile_targets, has_heuristic_results): | |
|
chanli
2017/01/07 02:39:39
I assume we can still keep this function and share
lijeffrey
2017/01/09 19:04:01
I think this function is different enough for all
| |
| 56 try_job_data = WfTryJobData.Create(build_id) | |
| 57 try_job_data.master_name = master_name | |
| 58 try_job_data.builder_name = builder_name | |
| 59 try_job_data.build_number = build_number | |
| 60 try_job_data.try_job_type = try_job_type | |
| 61 try_job_data.has_compile_targets = has_compile_targets | |
| 62 try_job_data.has_heuristic_results = has_heuristic_results | |
| 63 try_job_data.put() | |
| 64 | |
| 65 # Arguments number differs from overridden method - pylint: disable=W0221 | 51 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 66 def run( | 52 def run( |
| 67 self, master_name, builder_name, build_number, good_revision, | 53 self, master_name, builder_name, build_number, good_revision, |
| 68 bad_revision, try_job_type, suspected_revisions): | 54 bad_revision, try_job_type, suspected_revisions): |
| 69 raise NotImplementedError() | 55 raise NotImplementedError() |
| OLD | NEW |