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

Unified Diff: appengine/swarming/handlers_endpoints.py

Issue 2212073002: Add endpoint and cron job to aggregate all dimensions and values (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: y 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/handlers_endpoints.py
diff --git a/appengine/swarming/handlers_endpoints.py b/appengine/swarming/handlers_endpoints.py
index 0b353a30c5ba9424b2e5d0cd2883816d5b25c396..bec77580253cd7b6cc7f4a1a7ca4e1fefdc27b4a 100644
--- a/appengine/swarming/handlers_endpoints.py
+++ b/appengine/swarming/handlers_endpoints.py
@@ -644,7 +644,7 @@ class SwarmingBotsService(remote.Service):
"""Counts number of bots with given dimensions."""
logging.info('%s', request)
now = utils.utcnow()
- q = bot_management.BotInfo.query().order()
+ q = bot_management.BotInfo.query()
for d in request.dimensions:
parts = d.split(':', 1)
if len(parts) != 2 or any(i.strip() != i or not i for i in parts):
@@ -665,6 +665,22 @@ class SwarmingBotsService(remote.Service):
busy=f_busy.get_result(),
now=now)
+ @gae_ts_mon.instrument_endpoint()
+ @auth.endpoints_method(
+ message_types.VoidMessage, swarming_rpcs.BotsDimensions,
+ http_method='GET')
+ @auth.require(acl.is_privileged_user)
+ def dimensions(self, request):
+ """Returns the cached set of dimensions currently in use in the fleet."""
+ logging.info('%s', request)
+ agg = ndb.Key(bot_management.DimensionAggregation, 'current')
+ dims = agg.get()
+ fd = [swarming_rpcs.StringListPair(
+ key=d.dimension,
+ value=d.values) for d in dims.dimensions]
+ return swarming_rpcs.BotsDimensions(
+ fleet_dimensions=fd)
+
def get_routes():
return (

Powered by Google App Engine
This is Rietveld 408576698