Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: appengine/findit/waterfall/flake/initialize_flake_pipeline.py

Issue 2376573004: [Findit] For automatic analyses of flaky tests, run the Swarming tasks off PST peak hours. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from google.appengine.ext import ndb 5 from google.appengine.ext import ndb
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 model import analysis_status 9 from model import analysis_status
10 from model.flake.master_flake_analysis import MasterFlakeAnalysis 10 from model.flake.master_flake_analysis import MasterFlakeAnalysis
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 master_flake_analysis = MasterFlakeAnalysis.Create( 48 master_flake_analysis = MasterFlakeAnalysis.Create(
49 master_name, builder_name, build_number, step_name, test_name) 49 master_name, builder_name, build_number, step_name, test_name)
50 master_flake_analysis.status = analysis_status.PENDING 50 master_flake_analysis.status = analysis_status.PENDING
51 master_flake_analysis.put() 51 master_flake_analysis.put()
52 return True 52 return True
53 53
54 54
55 # Unused arguments - pylint: disable=W0612, W0613 55 # Unused arguments - pylint: disable=W0612, W0613
56 def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name, 56 def ScheduleAnalysisIfNeeded(master_name, builder_name, build_number, step_name,
57 test_name, allow_new_analysis=False, force=False, 57 test_name, allow_new_analysis=False, force=False,
58 manually_triggered=False,
58 queue_name=constants.DEFAULT_QUEUE): 59 queue_name=constants.DEFAULT_QUEUE):
59 """Schedules an analysis if needed and returns the MasterFlakeAnalysis. 60 """Schedules an analysis if needed and returns the MasterFlakeAnalysis.
60 61
61 When the build failure was already analyzed and a new analysis is scheduled, 62 When the build failure was already analyzed and a new analysis is scheduled,
62 the returned WfAnalysis will still have the result of last completed analysis. 63 the returned WfAnalysis will still have the result of last completed analysis.
63 64
64 Args: 65 Args:
65 master_name (str): The master name of the failed test 66 master_name (str): The master name of the failed test
66 builder_name (str): The builder name of the failed test 67 builder_name (str): The builder name of the failed test
67 build_number (int): The build number of the failed test 68 build_number (int): The build number of the failed test
68 step_name (str): The name of the test suite 69 step_name (str): The name of the test suite
69 test_name (str): The single test we are checking 70 test_name (str): The single test we are checking
70 allow_new_analysis (bool): Indicate whether a new analysis is allowed. 71 allow_new_analysis (bool): Indicate whether a new analysis is allowed.
71 force (bool): Indicate whether to force a rerun of current analysis. 72 force (bool): Indicate whether to force a rerun of current analysis.
73 manually_triggered (bool): True if the analysis is from manual request, like
74 by a Chromium sheriff.
72 queue_name (str): The App Engine queue to run the analysis. 75 queue_name (str): The App Engine queue to run the analysis.
73 76
74 Returns: 77 Returns:
75 A MasterFlakeAnalysis instance. 78 A MasterFlakeAnalysis instance.
76 None if no analysis was scheduled and the user has no permission to. 79 None if no analysis was scheduled and the user has no permission to.
77 """ 80 """
78 if NeedANewAnalysis( 81 if NeedANewAnalysis(
79 master_name, builder_name, build_number, step_name, test_name, 82 master_name, builder_name, build_number, step_name, test_name,
80 allow_new_analysis): 83 allow_new_analysis):
81 check_flake_settings = waterfall_config.GetCheckFlakeSettings() 84 check_flake_settings = waterfall_config.GetCheckFlakeSettings()
82 max_build_numbers_to_look_back = check_flake_settings.get( 85 max_build_numbers_to_look_back = check_flake_settings.get(
83 'max_build_numbers_to_look_back') 86 'max_build_numbers_to_look_back')
84 flakiness_algorithm_results_dict = { 87 flakiness_algorithm_results_dict = {
85 'flakes_in_a_row': 0, 88 'flakes_in_a_row': 0,
86 'stable_in_a_row': 0, 89 'stable_in_a_row': 0,
87 'stabled_out': False, 90 'stabled_out': False,
88 'flaked_out': False, 91 'flaked_out': False,
89 'last_build_number': max( 92 'last_build_number': max(
90 0, build_number - max_build_numbers_to_look_back), 93 0, build_number - max_build_numbers_to_look_back),
91 'lower_boundary': None, 94 'lower_boundary': None,
92 'upper_boundary': None, 95 'upper_boundary': None,
93 'lower_boundary_result': None, 96 'lower_boundary_result': None,
94 'sequential_run_index': 0 97 'sequential_run_index': 0
95 } 98 }
96 pipeline_job = RecursiveFlakePipeline( 99 pipeline_job = RecursiveFlakePipeline(
97 master_name, builder_name, build_number, step_name, test_name, 100 master_name, builder_name, build_number, step_name, test_name,
98 master_build_number=build_number, 101 master_build_number=build_number,
99 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict) 102 flakiness_algorithm_results_dict=flakiness_algorithm_results_dict,
103 manually_triggered=manually_triggered)
100 pipeline_job.target = appengine_util.GetTargetNameForModule( 104 pipeline_job.target = appengine_util.GetTargetNameForModule(
101 constants.WATERFALL_BACKEND) 105 constants.WATERFALL_BACKEND)
102 pipeline_job.start(queue_name=queue_name) 106 pipeline_job.start(queue_name=queue_name)
103 return MasterFlakeAnalysis.Get( 107 return MasterFlakeAnalysis.Get(
104 master_name, builder_name, build_number, step_name, test_name) 108 master_name, builder_name, build_number, step_name, test_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698