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

Side by Side Diff: appengine/findit/handlers/config.py

Issue 2258373002: [Findit] Move configurable parameters in try_job_util.py to config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | appengine/findit/handlers/test/config_test.py » ('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 2015 The Chromium Authors. All rights reserved. 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 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 """Handles requests to the findit config page.""" 5 """Handles requests to the findit config page."""
6 6
7 import json 7 import json
8 8
9 from common.base_handler import BaseHandler 9 from common.base_handler import BaseHandler
10 from common.base_handler import Permission 10 from common.base_handler import Permission
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (trybot_config.has_key('not_run_tests') and 144 if (trybot_config.has_key('not_run_tests') and
145 not isinstance(trybot_config['not_run_tests'], bool)): 145 not isinstance(trybot_config['not_run_tests'], bool)):
146 return False 146 return False
147 return True 147 return True
148 148
149 149
150 def _ValidateTryJobSettings(settings): 150 def _ValidateTryJobSettings(settings):
151 return (isinstance(settings, dict) and 151 return (isinstance(settings, dict) and
152 isinstance(settings.get('server_query_interval_seconds'), int) and 152 isinstance(settings.get('server_query_interval_seconds'), int) and
153 isinstance(settings.get('job_timeout_hours'), int) and 153 isinstance(settings.get('job_timeout_hours'), int) and
154 isinstance(settings.get('allowed_response_error_times'), int)) 154 isinstance(settings.get('allowed_response_error_times'), int) and
155 isinstance(settings.get('max_seconds_look_back_for_group'), int))
155 156
156 157
157 def _ValidateSwarmingSettings(settings): 158 def _ValidateSwarmingSettings(settings):
158 return (isinstance(settings, dict) and 159 return (isinstance(settings, dict) and
159 isinstance(settings.get('server_host'), basestring) and 160 isinstance(settings.get('server_host'), basestring) and
160 isinstance(settings.get('default_request_priority'), int) and 161 isinstance(settings.get('default_request_priority'), int) and
161 isinstance(settings.get('request_expiration_hours'), int) and 162 isinstance(settings.get('request_expiration_hours'), int) and
162 isinstance(settings.get('server_query_interval_seconds'), int) and 163 isinstance(settings.get('server_query_interval_seconds'), int) and
163 isinstance(settings.get('task_timeout_hours'), int) and 164 isinstance(settings.get('task_timeout_hours'), int) and
164 isinstance(settings.get('isolated_server'), basestring) and 165 isinstance(settings.get('isolated_server'), basestring) and
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 new_config_dict = json.loads(data) 266 new_config_dict = json.loads(data)
266 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover 267 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover
267 return self.CreateError( 268 return self.CreateError(
268 'New configuration settings is not properly formatted.', 400) 269 'New configuration settings is not properly formatted.', 400)
269 270
270 wf_config.FinditConfig.Get().Update(users.get_current_user(), 271 wf_config.FinditConfig.Get().Update(users.get_current_user(),
271 users.IsCurrentUserAdmin(), 272 users.IsCurrentUserAdmin(),
272 **new_config_dict) 273 **new_config_dict)
273 274
274 return self.HandleGet() 275 return self.HandleGet()
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/handlers/test/config_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698