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

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: pull out extra changes 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..a4a9f9b08edaab4d22a55fbc0c00041fb28a9101 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,26 @@ 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.warn('%s', request)
M-A Ruel 2016/08/04 21:01:15 info
kjlubick 2016/08/05 14:17:26 Done.
+ agg = ndb.Key(bot_management.DimensionAggregation, "current")
M-A Ruel 2016/08/04 21:01:15 single quote
kjlubick 2016/08/05 14:17:26 Done.
+ dims = agg.get()
+ logging.info(dims)
M-A Ruel 2016/08/04 21:01:15 don't
kjlubick 2016/08/05 14:17:26 Done.
+ fd = []
M-A Ruel 2016/08/04 21:01:15 use list comprehension
kjlubick 2016/08/05 14:17:26 Done.
+ for d in dims.dimensions:
+ fd.append(swarming_rpcs.StringListPair(
+ key=d.dimension,
+ value=d.values))
+ logging.info(fd)
M-A Ruel 2016/08/04 21:01:15 remove
kjlubick 2016/08/05 14:17:26 Done.
+ return swarming_rpcs.BotsDimensions(
+ fleet_dimensions=fd)
M-A Ruel 2016/08/04 21:01:15 bot_dimensions?
kjlubick 2016/08/05 14:17:26 Well, it's not the dimensions for just one bot. b
M-A Ruel 2016/08/05 14:36:04 bots_dimensions is better. We don't use the word "
+
def get_routes():
return (

Powered by Google App Engine
This is Rietveld 408576698