Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 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 datetime import datetime | |
| 6 | |
| 7 from common import appengine_util | |
| 8 from common import constants | |
| 9 from common.pipeline_wrapper import BasePipeline | |
| 10 | |
| 11 from model import analysis_status | |
| 12 from model.flake.master_flake_analysis import MasterFlakeAnalysis | |
| 13 from waterfall.trigger_flake_swarming_task_pipeline import ( | |
| 14 TriggerFlakeSwarmingTaskPipeline) | |
| 15 from waterfall.process_flake_swarming_task_result_pipeline import ( | |
| 16 ProcessFlakeSwarmingTaskResultPipeline) | |
| 17 | |
| 18 | |
| 19 class RecursiveFlakePipeline(BasePipeline): | |
| 20 | |
| 21 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 22 def run(self, master_name, builder_name, run_build_number, step_name, | |
| 23 test_name, master_build_number, queue_name=constants.DEFAULT_QUEUE): | |
| 24 # Call trigger pipeline (flake style). | |
| 25 task_id = yield TriggerFlakeSwarmingTaskPipeline(master_name, builder_name, | |
| 26 run_build_number, step_name, [test_name]) | |
| 27 # Pass the trigger pipeline into a process pipeline. | |
| 28 test_result_future = yield ProcessFlakeSwarmingTaskResultPipeline( | |
| 29 master_name, builder_name, run_build_number, | |
| 30 step_name, task_id, master_build_number, test_name) | |
| 31 yield NextBuildNumberPipeline( | |
| 32 master_name, builder_name, master_build_number, | |
| 33 step_name, test_name, test_result_future, queue_name) | |
| 34 | |
| 35 class NextBuildNumberPipeline(BasePipeline): | |
| 36 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 37 # Unused argument - pylint: disable=W0613 | |
| 38 def run(self, master_name, builder_name, master_build_number, step_name, | |
| 39 test_name, test_result_future, queue_name): | |
| 40 # Get MasterFlakeAnalysis success list corresponding to parameters. | |
| 41 master = MasterFlakeAnalysis.Get(master_name, builder_name, | |
| 42 master_build_number, step_name, test_name) | |
| 43 # Figure out what build_number we should call, if any | |
| 44 # This is a placeholder for testing: | |
|
lijeffrey
2016/07/26 20:49:02
What do you mean this is a placeholder for testing
caiw
2016/07/26 21:09:01
I think I addressed this and the comment about the
| |
| 45 next_run = False | |
| 46 if len(master.build_numbers) < 10: | |
|
lijeffrey
2016/07/26 20:49:02
nit: Move 10 to a constant at the top of the file
caiw
2016/07/26 21:09:01
Acknowledged.
| |
| 47 # TODO(caiw): Develop algorithm to optimize this. | |
| 48 next_run = min(master.build_numbers) - 10 | |
| 49 if next_run: | |
| 50 pipeline_job = RecursiveFlakePipeline( | |
| 51 master_name, builder_name, next_run, step_name, test_name, | |
| 52 master_build_number) | |
| 53 #pylint: disable=W0201 | |
| 54 pipeline_job.target = appengine_util.GetTargetNameForModule( | |
| 55 constants.WATERFALL_BACKEND) | |
| 56 pipeline_job.start(queue_name=queue_name) | |
| OLD | NEW |