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

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

Issue 2676513004: Add task-list summary (Closed)
Patch Set: Increase summary scope 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
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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 @gae_ts_mon.instrument_endpoint() 482 @gae_ts_mon.instrument_endpoint()
483 @auth.endpoints_method( 483 @auth.endpoints_method(
484 swarming_rpcs.TasksCountRequest, swarming_rpcs.TasksCount, 484 swarming_rpcs.TasksCountRequest, swarming_rpcs.TasksCount,
485 http_method='GET') 485 http_method='GET')
486 @auth.require(acl.is_privileged_user) 486 @auth.require(acl.is_privileged_user)
487 def count(self, request): 487 def count(self, request):
488 """Counts number of tasks in a given state.""" 488 """Counts number of tasks in a given state."""
489 logging.info('%s', request) 489 logging.info('%s', request)
490 if not request.start: 490 if not request.start:
491 raise endpoints.BadRequestException('start (as epoch) is required') 491 raise endpoints.BadRequestException('start (as epoch) is required')
492 if not request.end:
493 raise endpoints.BadRequestException('end (as epoch) is required')
494 now = utils.utcnow() 492 now = utils.utcnow()
495 try: 493 try:
496 count = self._query_from_request(request, 'created_ts').count() 494 count = self._query_from_request(request, 'created_ts').count()
497 except ValueError as e: 495 except ValueError as e:
498 raise endpoints.BadRequestException( 496 raise endpoints.BadRequestException(
499 'Inappropriate filter for tasks/count: %s' % e) 497 'Inappropriate filter for tasks/count: %s' % e)
500 return swarming_rpcs.TasksCount(count=count, now=now) 498 return swarming_rpcs.TasksCount(count=count, now=now)
501 499
502 def _query_from_request(self, request, sort=None): 500 def _query_from_request(self, request, sort=None):
503 """Returns a TaskResultSummary query.""" 501 """Returns a TaskResultSummary query."""
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 def get_routes(): 799 def get_routes():
802 return ( 800 return (
803 endpoints_webapp2.api_routes(SwarmingServerService) + 801 endpoints_webapp2.api_routes(SwarmingServerService) +
804 endpoints_webapp2.api_routes(SwarmingTaskService) + 802 endpoints_webapp2.api_routes(SwarmingTaskService) +
805 endpoints_webapp2.api_routes(SwarmingTasksService) + 803 endpoints_webapp2.api_routes(SwarmingTasksService) +
806 endpoints_webapp2.api_routes(SwarmingBotService) + 804 endpoints_webapp2.api_routes(SwarmingBotService) +
807 endpoints_webapp2.api_routes(SwarmingBotsService) + 805 endpoints_webapp2.api_routes(SwarmingBotsService) +
808 # components.config endpoints for validation and configuring of luci-config 806 # components.config endpoints for validation and configuring of luci-config
809 # service URL. 807 # service URL.
810 endpoints_webapp2.api_routes(config.ConfigApi)) 808 endpoints_webapp2.api_routes(config.ConfigApi))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698