| 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 appengine_util | 7 from common import appengine_util |
| 8 from common import constants | 8 from common import constants |
| 9 from common import time_util | 9 from common import time_util |
| 10 from model import analysis_status | 10 from model import analysis_status |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 else: | 46 else: |
| 47 # The previous analysis had some error, so reset and run as a new version. | 47 # The previous analysis had some error, so reset and run as a new version. |
| 48 master_flake_analysis.Reset() | 48 master_flake_analysis.Reset() |
| 49 _, saved = master_flake_analysis.Save() | 49 _, saved = master_flake_analysis.Save() |
| 50 return saved | 50 return saved |
| 51 | 51 |
| 52 | 52 |
| 53 # Unused arguments - pylint: disable=W0612, W0613 | 53 # Unused arguments - pylint: disable=W0612, W0613 |
| 54 def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name, | 54 def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name, |
| 55 test_name, allow_new_analysis=False, force=False, | 55 test_name, allow_new_analysis=False, force=False, |
| 56 manually_triggered=False, |
| 56 queue_name=constants.DEFAULT_QUEUE): | 57 queue_name=constants.DEFAULT_QUEUE): |
| 57 """Schedules an analysis if needed and returns the MasterFlakeAnalysis. | 58 """Schedules an analysis if needed and returns the MasterFlakeAnalysis. |
| 58 | 59 |
| 59 When the build failure was already analyzed and a new analysis is scheduled, | 60 When the build failure was already analyzed and a new analysis is scheduled, |
| 60 the returned WfAnalysis will still have the result of last completed analysis. | 61 the returned WfAnalysis will still have the result of last completed analysis. |
| 61 | 62 |
| 62 Args: | 63 Args: |
| 63 master_name (str): The master name of the failed test | 64 master_name (str): The master name of the failed test |
| 64 builder_name (str): The builder name of the failed test | 65 builder_name (str): The builder name of the failed test |
| 65 build_number (int): The build number of the failed test | 66 build_number (int): The build number of the failed test |
| 66 step_name (str): The name of the test suite | 67 step_name (str): The name of the test suite |
| 67 test_name (str): The single test we are checking | 68 test_name (str): The single test we are checking |
| 68 allow_new_analysis (bool): Indicate whether a new analysis is allowed. | 69 allow_new_analysis (bool): Indicate whether a new analysis is allowed. |
| 69 force (bool): Indicate whether to force a rerun of current analysis. | 70 force (bool): Indicate whether to force a rerun of current analysis. |
| 71 manually_triggered (bool): True if the analysis is from manual request, like |
| 72 by a Chromium sheriff. |
| 70 queue_name (str): The App Engine queue to run the analysis. | 73 queue_name (str): The App Engine queue to run the analysis. |
| 71 | 74 |
| 72 Returns: | 75 Returns: |
| 73 A MasterFlakeAnalysis instance. | 76 A MasterFlakeAnalysis instance. |
| 74 None if no analysis was scheduled and the user has no permission to. | 77 None if no analysis was scheduled and the user has no permission to. |
| 75 """ | 78 """ |
| 76 | 79 |
| 77 version_number = None | 80 version_number = None |
| 78 | 81 |
| 79 if NeedANewAnalysis( | 82 if NeedANewAnalysis( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 108 0, build_number - max_build_numbers_to_look_back), | 111 0, build_number - max_build_numbers_to_look_back), |
| 109 'lower_boundary': None, | 112 'lower_boundary': None, |
| 110 'upper_boundary': None, | 113 'upper_boundary': None, |
| 111 'lower_boundary_result': None, | 114 'lower_boundary_result': None, |
| 112 'sequential_run_index': 0 | 115 'sequential_run_index': 0 |
| 113 } | 116 } |
| 114 | 117 |
| 115 pipeline_job = RecursiveFlakePipeline( | 118 pipeline_job = RecursiveFlakePipeline( |
| 116 master_name, builder_name, build_number, step_name, test_name, | 119 master_name, builder_name, build_number, step_name, test_name, |
| 117 version_number, master_build_number=build_number, | 120 version_number, master_build_number=build_number, |
| 118 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict) | 121 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict, |
| 122 manually_triggered=manually_triggered) |
| 119 pipeline_job.target = appengine_util.GetTargetNameForModule( | 123 pipeline_job.target = appengine_util.GetTargetNameForModule( |
| 120 constants.WATERFALL_BACKEND) | 124 constants.WATERFALL_BACKEND) |
| 121 pipeline_job.start(queue_name=queue_name) | 125 pipeline_job.StartOffPSTPeakHours(queue_name=queue_name) |
| 122 return MasterFlakeAnalysis.GetVersion( | 126 return MasterFlakeAnalysis.GetVersion( |
| 123 master_name, builder_name, build_number, step_name, test_name, | 127 master_name, builder_name, build_number, step_name, test_name, |
| 124 version=version_number) | 128 version=version_number) |
| OLD | NEW |