| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 import logging | 5 import logging |
| 6 | 6 |
| 7 from common import constants | |
| 8 from common import time_util | 7 from common import time_util |
| 9 from common.pipeline_wrapper import BasePipeline | 8 from common.pipeline_wrapper import BasePipeline |
| 10 from model.flake. flake_analysis_request import FlakeAnalysisRequest | 9 from model.flake. flake_analysis_request import FlakeAnalysisRequest |
| 11 from model.wf_analysis import WfAnalysis | 10 from model.wf_analysis import WfAnalysis |
| 12 from model.wf_swarming_task import WfSwarmingTask | 11 from model.wf_swarming_task import WfSwarmingTask |
| 13 from waterfall.flake import flake_analysis_service | 12 from waterfall.flake import flake_analysis_service |
| 13 from waterfall.flake import triggering_sources |
| 14 | 14 |
| 15 | 15 |
| 16 class TriggerFlakeAnalysesPipeline(BasePipeline): | 16 class TriggerFlakeAnalysesPipeline(BasePipeline): |
| 17 """A pipeline that automatically triggers flake analyses.""" | 17 """A pipeline that automatically triggers flake analyses.""" |
| 18 | 18 |
| 19 # Arguments number differs from overridden method - pylint: disable=W0221 | 19 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 20 def run(self, master_name, builder_name, build_number): | 20 def run(self, master_name, builder_name, build_number): |
| 21 """Triggers flake analyses for flaky tests found by build failure analysis. | 21 """Triggers flake analyses for flaky tests found by build failure analysis. |
| 22 | 22 |
| 23 Args: | 23 Args: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 # within reasonable limits. For experimentation with automatic flakiness | 48 # within reasonable limits. For experimentation with automatic flakiness |
| 49 # checking, only run 1 test per anaysis to avoid excessive load on the | 49 # checking, only run 1 test per anaysis to avoid excessive load on the |
| 50 # swarming server in case there are too many flaky tests per analysis for | 50 # swarming server in case there are too many flaky tests per analysis for |
| 51 # now. | 51 # now. |
| 52 test_name = flaky_tests[0] | 52 test_name = flaky_tests[0] |
| 53 request = FlakeAnalysisRequest.Create(test_name, False, None) | 53 request = FlakeAnalysisRequest.Create(test_name, False, None) |
| 54 request.AddBuildStep( | 54 request.AddBuildStep( |
| 55 master_name, builder_name, build_number, step, | 55 master_name, builder_name, build_number, step, |
| 56 time_util.GetUTCNow()) | 56 time_util.GetUTCNow()) |
| 57 scheduled = flake_analysis_service.ScheduleAnalysisForFlake( | 57 scheduled = flake_analysis_service.ScheduleAnalysisForFlake( |
| 58 request, 'findit-for-me@appspot.gserviceaccount.com', False) | 58 request, 'findit-for-me@appspot.gserviceaccount.com', False, |
| 59 triggering_sources.FINDIT_PIPELINE) |
| 59 | 60 |
| 60 if scheduled: # pragma: no branch | 61 if scheduled: # pragma: no branch |
| 61 logging.info('%s/%s/%s has %s flaky tests.', | 62 logging.info('%s/%s/%s has %s flaky tests.', |
| 62 master_name, builder_name, build_number, len(flaky_tests)) | 63 master_name, builder_name, build_number, len(flaky_tests)) |
| 63 logging.info('A flake analysis has been triggered for %s', test_name) | 64 logging.info('A flake analysis has been triggered for %s', test_name) |
| OLD | NEW |