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

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

Issue 2676513004: Add task-list summary (Closed)
Patch Set: rebase Created 3 years, 10 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/swarming/ui/build/elements.html » ('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 LUCI Authors. All rights reserved. 1 # Copyright 2015 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 """This module defines Swarming Server endpoints handlers.""" 5 """This module defines Swarming Server endpoints handlers."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 9
10 from google.appengine.api import datastore_errors 10 from google.appengine.api import datastore_errors
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 @gae_ts_mon.instrument_endpoint() 483 @gae_ts_mon.instrument_endpoint()
484 @auth.endpoints_method( 484 @auth.endpoints_method(
485 swarming_rpcs.TasksCountRequest, swarming_rpcs.TasksCount, 485 swarming_rpcs.TasksCountRequest, swarming_rpcs.TasksCount,
486 http_method='GET') 486 http_method='GET')
487 @auth.require(acl.is_privileged_user) 487 @auth.require(acl.is_privileged_user)
488 def count(self, request): 488 def count(self, request):
489 """Counts number of tasks in a given state.""" 489 """Counts number of tasks in a given state."""
490 logging.info('%s', request) 490 logging.info('%s', request)
491 if not request.start: 491 if not request.start:
492 raise endpoints.BadRequestException('start (as epoch) is required') 492 raise endpoints.BadRequestException('start (as epoch) is required')
493 if not request.end:
494 raise endpoints.BadRequestException('end (as epoch) is required')
495 now = utils.utcnow() 493 now = utils.utcnow()
496 try: 494 try:
497 count = self._query_from_request(request, 'created_ts').count() 495 count = self._query_from_request(request, 'created_ts').count()
498 except ValueError as e: 496 except ValueError as e:
499 raise endpoints.BadRequestException( 497 raise endpoints.BadRequestException(
500 'Inappropriate filter for tasks/count: %s' % e) 498 'Inappropriate filter for tasks/count: %s' % e)
501 return swarming_rpcs.TasksCount(count=count, now=now) 499 return swarming_rpcs.TasksCount(count=count, now=now)
502 500
503 def _query_from_request(self, request, sort=None): 501 def _query_from_request(self, request, sort=None):
504 """Returns a TaskResultSummary query.""" 502 """Returns a TaskResultSummary query."""
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 def get_routes(): 800 def get_routes():
803 return ( 801 return (
804 endpoints_webapp2.api_routes(SwarmingServerService) + 802 endpoints_webapp2.api_routes(SwarmingServerService) +
805 endpoints_webapp2.api_routes(SwarmingTaskService) + 803 endpoints_webapp2.api_routes(SwarmingTaskService) +
806 endpoints_webapp2.api_routes(SwarmingTasksService) + 804 endpoints_webapp2.api_routes(SwarmingTasksService) +
807 endpoints_webapp2.api_routes(SwarmingBotService) + 805 endpoints_webapp2.api_routes(SwarmingBotService) +
808 endpoints_webapp2.api_routes(SwarmingBotsService) + 806 endpoints_webapp2.api_routes(SwarmingBotsService) +
809 # components.config endpoints for validation and configuring of luci-config 807 # components.config endpoints for validation and configuring of luci-config
810 # service URL. 808 # service URL.
811 endpoints_webapp2.api_routes(config.ConfigApi)) 809 endpoints_webapp2.api_routes(config.ConfigApi))
OLDNEW
« no previous file with comments | « no previous file | appengine/swarming/ui/build/elements.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698