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

Unified Diff: appengine/swarming/event_mon_metrics.py

Issue 2926713004: Add support for repeated keys in TaskRequest. (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « appengine/swarming/doc/Schemas.md ('k') | appengine/swarming/handlers_bot_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/event_mon_metrics.py
diff --git a/appengine/swarming/event_mon_metrics.py b/appengine/swarming/event_mon_metrics.py
index 00eb1169eb13a2f0f2b4a74092718570af2ebef8..b49d7c9b9afa5cfbd9ea84d8ee45e3e5189033ff 100644
--- a/appengine/swarming/event_mon_metrics.py
+++ b/appengine/swarming/event_mon_metrics.py
@@ -10,19 +10,19 @@ import gae_event_mon
from server import task_result
-DIMENSIONS = (
- ('cores', int),
- ('cpu', unicode),
- ('device_os', unicode),
- ('device_type', unicode),
- ('gpu', unicode),
- ('hidpi', unicode),
- ('machine_type', unicode),
- ('os', unicode),
- ('pool', unicode),
- ('xcode_version', unicode),
- ('zone', unicode),
-)
+DIMENSIONS = {
+ 'cores': int,
+ 'cpu': unicode,
+ 'device_os': unicode,
+ 'device_type': unicode,
+ 'gpu': unicode,
+ 'hidpi': unicode,
+ 'machine_type': unicode,
+ 'os': unicode,
+ 'pool': unicode,
+ 'xcode_version': unicode,
+ 'zone': unicode,
+}
TAGS = {
@@ -90,10 +90,9 @@ def _task_summary_to_proto(summary, event):
package_proto = cipd_proto.packages.add()
_cipd_package_to_proto(package, package_proto)
- for d, t in DIMENSIONS:
- if d in task_properties.dimensions:
- getattr(properties_proto.dimensions, d).append(
- t(task_properties.dimensions[d]))
+ for key, value in task_properties.dimensions:
+ if key in DIMENSIONS:
+ getattr(properties_proto.dimensions, key).append(DIMENSIONS[key](value))
if task_properties.execution_timeout_secs:
properties_proto.execution_timeout_s = \
@@ -121,7 +120,7 @@ def _task_summary_to_proto(summary, event):
event.proto.swarming_task_event.bot_id = summary.bot_id
event.proto.swarming_task_event.bot_version = summary.bot_version
- for d, t in DIMENSIONS:
+ for d, t in DIMENSIONS.iteritems():
for v in summary.bot_dimensions.get(d, []):
getattr(event.proto.swarming_task_event.bot_dimensions, d).append(t(v))
« no previous file with comments | « appengine/swarming/doc/Schemas.md ('k') | appengine/swarming/handlers_bot_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698