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

Side by Side Diff: appengine/findit/handlers/flake/check_flake.py

Issue 2376573004: [Findit] For automatic analyses of flaky tests, run the Swarming tasks off PST peak hours. (Closed)
Patch Set: Fix nit. 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
« no previous file with comments | « appengine/findit/common/time_util.py ('k') | appengine/findit/third_party/gae-pytz » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.api import users 5 from google.appengine.api import users
6 6
7 from common import constants 7 from common import constants
8 from common.base_handler import BaseHandler 8 from common.base_handler import BaseHandler
9 from common.base_handler import Permission 9 from common.base_handler import Permission
10 from model.analysis_status import STATUS_TO_DESCRIPTION 10 from model.analysis_status import STATUS_TO_DESCRIPTION
(...skipping 10 matching lines...) Expand all
21 builder_name = self.request.get('builder_name').strip() 21 builder_name = self.request.get('builder_name').strip()
22 build_number = int(self.request.get('build_number').strip()) 22 build_number = int(self.request.get('build_number').strip())
23 step_name = self.request.get('step_name').strip() 23 step_name = self.request.get('step_name').strip()
24 test_name = self.request.get('test_name').strip() 24 test_name = self.request.get('test_name').strip()
25 force = (users.is_current_user_admin() and 25 force = (users.is_current_user_admin() and
26 self.request.get('force') == '1') 26 self.request.get('force') == '1')
27 allow_new_analysis = self.IsCorpUserOrAdmin() 27 allow_new_analysis = self.IsCorpUserOrAdmin()
28 28
29 master_flake_analysis = ScheduleAnalysisIfNeeded( 29 master_flake_analysis = ScheduleAnalysisIfNeeded(
30 master_name, builder_name, build_number, step_name, test_name, 30 master_name, builder_name, build_number, step_name, test_name,
31 allow_new_analysis, force=force, 31 allow_new_analysis, force=force, manually_triggered=True,
32 queue_name=constants.WATERFALL_ANALYSIS_QUEUE) 32 queue_name=constants.WATERFALL_ANALYSIS_QUEUE)
33 33
34 if not master_flake_analysis: # pragma: no cover. 34 if not master_flake_analysis: # pragma: no cover.
35 return { 35 return {
36 'template': 'error.html', 36 'template': 'error.html',
37 'data': { 37 'data': {
38 'error_message': 38 'error_message':
39 ('You could schedule an analysis for flaky test only after ' 39 ('You could schedule an analysis for flaky test only after '
40 'you login with google.com account.'), 40 'you login with google.com account.'),
41 'login_url': self.GetLoginUrl(), 41 'login_url': self.GetLoginUrl(),
42 }, 42 },
43 'return_code': 401, 43 'return_code': 401,
44 } 44 }
45 45
46 data = { 46 data = {
47 'pass_rates': [], 47 'pass_rates': [],
48 'analysis_status': STATUS_TO_DESCRIPTION.get( 48 'analysis_status': STATUS_TO_DESCRIPTION.get(
49 master_flake_analysis.status), 49 master_flake_analysis.status),
50 'suspected_flake_build_number': ( 50 'suspected_flake_build_number': (
51 master_flake_analysis.suspected_flake_build_number), 51 master_flake_analysis.suspected_flake_build_number),
52 'master_name': master_name, 52 'master_name': master_name,
53 'builder_name': builder_name, 53 'builder_name': builder_name,
54 'build_number': build_number, 54 'build_number': build_number,
55 'step_name': step_name, 55 'step_name': step_name,
56 'test_name': test_name, 56 'test_name': test_name,
57 } 57 }
58 58
59 build_numbers = []
60 pass_rates = []
61 coordinates = [] 59 coordinates = []
62 60
63 for data_point in master_flake_analysis.data_points: 61 for data_point in master_flake_analysis.data_points:
64 coordinates.append((data_point.build_number, data_point.pass_rate)) 62 coordinates.append([data_point.build_number, data_point.pass_rate])
65 63
66 # Order by build number from earliest to latest. 64 # Order by build number from earliest to latest.
67 coordinates.sort(key=lambda x: x[0]) 65 coordinates.sort(key=lambda x: x[0])
68 66
69 data['pass_rates'] = coordinates 67 data['pass_rates'] = coordinates
70 68
71 return { 69 return {
72 'template': 'flake/result.html', 70 'template': 'flake/result.html',
73 'data': data 71 'data': data
74 } 72 }
OLDNEW
« no previous file with comments | « appengine/findit/common/time_util.py ('k') | appengine/findit/third_party/gae-pytz » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698