Chromium Code Reviews| 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 datetime import datetime | |
| 6 import logging | |
| 7 | |
| 8 from common import appengine_util | |
| 9 from common import constants | |
| 10 from common.pipeline_wrapper import BasePipeline | |
| 11 | |
| 12 from model import analysis_status | |
| 13 from model.flake.master_flake_analysis import MasterFlakeAnalysis as MFA | |
|
stgao
2016/07/09 00:04:33
I understand the class name is a bit long, but the
caiw
2016/07/14 00:59:44
Done.
| |
| 14 from waterfall.trigger_flake_swarming_task_pipeline import ( | |
| 15 TriggerFlakeSwarmingTaskPipeline as TFSTP) | |
| 16 from waterfall.process_flake_swarming_task_result_pipeline import ( | |
| 17 ProcessFlakeSwarmingTaskResultPipeline as PFSTRP) | |
| 18 | |
| 19 | |
| 20 class RecursiveFlakePipeline(BasePipeline): | |
| 21 | |
| 22 def __init__(self, master_name, builder_name, | |
| 23 step_name, build_number, testcase): | |
| 24 super(RecursiveFlakePipeline, self).__init__( | |
| 25 master_name, builder_name, step_name, build_number, testcase) | |
| 26 self.master_name = master_name | |
|
stgao
2016/07/09 00:04:33
Why do we need to save these values? they seems no
| |
| 27 self.builder_name = builder_name | |
| 28 self.step_name = step_name | |
| 29 self.build_number = build_number | |
| 30 self.testcase = testcase | |
| 31 self.step_future = None | |
| 32 self.build_completed = None | |
| 33 self.target = None | |
| 34 | |
| 35 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 36 def run(self, master_name, builder_name, step_name, build_number, | |
| 37 testcase, queue_name=constants.DEFAULT_QUEUE): | |
| 38 # Call trigger pipeline (flake style) | |
| 39 task_id = yield TFSTP(master_name, builder_name, | |
| 40 build_number, step_name, [testcase]) | |
| 41 # Pass the trigger pipeline into a process pipeline (flake style) | |
| 42 step_future = yield PFSTRP( | |
|
stgao
2016/07/09 00:04:33
rename ``step_future`` to "test_result_future``?
caiw
2016/07/14 00:59:44
Done.
| |
| 43 master_name, builder_name, build_number, step_name, task_id) | |
| 44 yield NextBuildNumberPipeline( | |
| 45 master_name, builder_name, step_name, testcase, step_future, queue_name) | |
| 46 | |
| 47 class NextBuildNumberPipeline(BasePipeline): | |
|
chanli
2016/07/08 16:58:54
Any reason you wrote these 2 classes in the same f
caiw
2016/07/14 00:59:44
Is there a convention of one class per file? I th
| |
| 48 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 49 # Unused argument - pylint: disable=W0613 | |
| 50 def run(self, master_name, builder_name, step_name, | |
| 51 testcase, step_future, queue_name): | |
| 52 # Get MFA success list corresponding to parameters | |
| 53 master = MFA.Get(master_name, builder_name, step_name) | |
| 54 # From the list, figure out what build_number we should call, if any | |
| 55 # This is a placeholder for testing: | |
| 56 next_run = False | |
| 57 if len(master.build_numbers) < 10: | |
| 58 # Placeholder until we develop an algorithm | |
|
stgao
2016/07/09 00:04:33
Add a TODO here?
caiw
2016/07/14 00:59:44
Done.
| |
| 59 next_run = min(master.build_numbers) - 10 | |
| 60 if next_run: | |
| 61 logging.info("Calling recursive pipeline again.") | |
| 62 pipeline_job = RecursiveFlakePipeline( | |
| 63 master_name, builder_name, step_name, | |
| 64 next_run, testcase) | |
| 65 pipeline_job.target = appengine_util.GetTargetNameForModule( | |
| 66 constants.WATERFALL_BACKEND) | |
| 67 pipeline_job.start(queue_name=queue_name) | |
| OLD | NEW |