Index: dashboard/dashboard/add_histograms_queue.py |
diff --git a/dashboard/dashboard/add_histograms_queue.py b/dashboard/dashboard/add_histograms_queue.py |
index 742f84f5c3ec69ba98339a665d810bd3e27c0fe1..cbae055de3ddb2cc2c942c2c9890eeffb5f0f6b6 100644 |
--- a/dashboard/dashboard/add_histograms_queue.py |
+++ b/dashboard/dashboard/add_histograms_queue.py |
@@ -7,12 +7,12 @@ |
import json |
from dashboard import add_histograms |
+from dashboard import add_point_queue |
shatch
2017/05/16 15:47:44
Probably want to move these helpers to a common sp
eakuefner
2017/05/19 18:51:48
Added TODO. It's true that moving these helpers to
|
from dashboard.common import datastore_hooks |
from dashboard.common import request_handler |
-from dashboard.common import utils |
+from dashboard.common import stored_object |
from dashboard.models import histogram |
- |
class AddHistogramsQueueHandler(request_handler.RequestHandler): |
"""Request handler to process a histogram and add it to the datastore. |
@@ -43,10 +43,38 @@ class AddHistogramsQueueHandler(request_handler.RequestHandler): |
datastore_hooks.SetPrivilegedRequest() |
data = self.request.get('data') |
- data_dict = json.loads(data) |
revision = int(self.request.get('revision')) |
- test_key = utils.TestKey(self.request.get('test_path')) |
+ test_path = self.request.get('test_path') |
+ |
+ data_dict = json.loads(data) |
guid = data_dict['guid'] |
+ is_histogram = ( |
+ data_dict.get('type') in add_histograms.SPARSE_DIAGNOSTIC_TYPES) |
+ |
+ test_path_parts = test_path.split('/') |
+ master = test_path_parts[0] |
+ bot = test_path_parts[1] |
+ |
+ bot_whitelist = stored_object.Get(add_point_queue.BOT_WHITELIST_KEY) |
+ internal_only = add_point_queue.BotInternalOnly(bot, bot_whitelist) |
+ |
+ test_name = '/'.join(test_path_parts[2:]) |
+ |
+ extra_args = {} |
shatch
2017/05/16 15:47:44
Maybe move this to _GetExtraArgs() or something to
eakuefner
2017/05/19 18:51:48
Done and renamed to unit_args.
|
+ if is_histogram: |
+ unit = data_dict['unit'] |
+ extra_args['units'] = unit |
+ # TODO(eakuefner): Port unit system to Python and use that here |
+ histogram_improvement_direction = unit.split('_')[-1] |
+ if histogram_improvement_direction == 'biggerIsBetter': |
+ extra_args['improvement_direction'] = 'up' |
+ elif histogram_improvement_direction == 'smallerIsBetter': |
+ extra_args['improvement_direction'] = 'down' |
+ |
+ # TDOO(eakuefner): Populate benchmark_description once it appears in |
+ # diagnostics. |
+ test_key = add_point_queue.GetOrCreateAncestors( |
+ master, bot, test_name, internal_only, **extra_args).key |
if data_dict.get('type') in add_histograms.SPARSE_DIAGNOSTIC_TYPES: |
entity = histogram.SparseDiagnostic( |