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

Side by Side Diff: appengine/swarming/handlers_frontend.py

Issue 2463483002: swarming: allow privileged users to schedule high priority tasks (Closed)
Patch Set: Created 4 years, 1 month 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 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Main entry point for Swarming service. 5 """Main entry point for Swarming service.
6 6
7 This file contains the URL handlers for all the Swarming service URLs, 7 This file contains the URL handlers for all the Swarming service URLs,
8 implemented using the webapp2 framework. 8 implemented using the webapp2 framework.
9 """ 9 """
10 10
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 Retrying a task forcibly make it not idempotent so the task is unconditionally 744 Retrying a task forcibly make it not idempotent so the task is unconditionally
745 scheduled. 745 scheduled.
746 """ 746 """
747 747
748 @auth.require(acl.is_user) 748 @auth.require(acl.is_user)
749 def post(self, task_id): 749 def post(self, task_id):
750 original_request, _ = self.get_request_and_result(task_id) 750 original_request, _ = self.get_request_and_result(task_id)
751 # Retrying a task is essentially reusing the same task request as the 751 # Retrying a task is essentially reusing the same task request as the
752 # original one, but with new parameters. 752 # original one, but with new parameters.
753 new_request = task_request.new_request_clone( 753 new_request = task_request.new_request_clone(
754 original_request, allow_high_priority=acl.is_admin()) 754 original_request,
755 allow_high_priority=acl.can_schedule_high_priority_tasks())
755 result_summary = task_scheduler.schedule_request(new_request) 756 result_summary = task_scheduler.schedule_request(new_request)
756 self.redirect('/user/task/%s' % result_summary.task_id) 757 self.redirect('/user/task/%s' % result_summary.task_id)
757 758
758 759
759 ### Public pages. 760 ### Public pages.
760 761
761 762
762 class OldUIHandler(auth.AuthenticatingHandler): 763 class OldUIHandler(auth.AuthenticatingHandler):
763 @auth.public 764 @auth.public
764 def get(self): 765 def get(self):
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 860
860 # If running on a local dev server, allow bots to connect without prior 861 # If running on a local dev server, allow bots to connect without prior
861 # groups configuration. Useful when running smoke test. 862 # groups configuration. Useful when running smoke test.
862 if utils.is_local_dev_server(): 863 if utils.is_local_dev_server():
863 acl.bootstrap_dev_server_acls() 864 acl.bootstrap_dev_server_acls()
864 865
865 routes.extend(handlers_backend.get_routes()) 866 routes.extend(handlers_backend.get_routes())
866 routes.extend(handlers_bot.get_routes()) 867 routes.extend(handlers_bot.get_routes())
867 routes.extend(handlers_endpoints.get_routes()) 868 routes.extend(handlers_endpoints.get_routes())
868 return webapp2.WSGIApplication(routes, debug=debug) 869 return webapp2.WSGIApplication(routes, debug=debug)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698