Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
|
stgao
2017/01/10 05:56:02
nit: 2017
lijeffrey
2017/01/10 09:32:07
Done.
| |
| 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 model.flake.flake_try_job import FlakeTryJob | |
| 6 from model.flake.flake_try_job_data import FlakeTryJobData | |
| 7 from waterfall import waterfall_config | |
| 8 from waterfall.schedule_try_job_pipeline import ScheduleTryJobPipeline | |
| 9 | |
| 10 | |
| 11 class ScheduleFlakeTryJobPipeline(ScheduleTryJobPipeline): | |
| 12 """A pipeline for scheduling a new flake try job for a flaky test.""" | |
| 13 | |
| 14 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 15 def _GetBuildProperties( | |
| 16 self, master_name, builder_name, step_name, test_name, git_hash): | |
| 17 iterations = waterfall_config.GetCheckFlakeSettings().get( | |
| 18 'iterations_to_rerun') | |
| 19 | |
| 20 return { | |
| 21 'recipe': 'findit/chromium/flake', | |
| 22 'target_mastername': master_name, | |
| 23 'target_testername': builder_name, | |
| 24 'test_revision': git_hash, | |
| 25 'test_repeat_count': iterations, | |
| 26 'tests': { | |
| 27 step_name: [test_name] | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 def _CreateTryJobData(self, build_id, try_job_key): | |
| 32 try_job_data = FlakeTryJobData.Create(build_id) | |
| 33 try_job_data.try_job_key = try_job_key | |
| 34 try_job_data.put() | |
| 35 | |
| 36 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 37 def run(self, master_name, builder_name, step_name, test_name, git_hash): | |
| 38 """ | |
| 39 Args: | |
| 40 master_name (str): The master name of a flaky test. | |
| 41 builder_name (str): the builder name of a flaky test. | |
|
stgao
2017/01/10 05:56:02
nit: the -> The
lijeffrey
2017/01/10 09:32:07
Done.
| |
| 42 step_name (str): The name of the step the flaky test occurred on. | |
|
stgao
2017/01/10 05:56:02
Should it be test_target or step_name?
@chanli: w
| |
| 43 test_name (str): The name of the flaky test. | |
| 44 git_hash (str): The git hash of the revision to run the try job against. | |
| 45 | |
| 46 Returns: | |
| 47 build_id (str): Id of the triggered try job. | |
| 48 """ | |
| 49 properties = self._GetBuildProperties( | |
| 50 master_name, builder_name, step_name, test_name, git_hash) | |
| 51 build_id = self._TriggerTryJob(master_name, builder_name, properties, {}) | |
| 52 | |
| 53 try_job = FlakeTryJob.Get( | |
| 54 master_name, builder_name, step_name, test_name, git_hash) | |
| 55 try_job.flake_results.append({'try_job_id': build_id}) | |
| 56 try_job.try_job_ids.append(build_id) | |
| 57 try_job.put() | |
| 58 | |
| 59 # Create a corresponding Flake entity to capture as much metadata as early | |
| 60 # as possible. | |
| 61 self._CreateTryJobData(build_id, try_job.key) | |
| 62 | |
| 63 return build_id | |
| OLD | NEW |