[PATCH] D37339: [LNT] Invalid field being used on the samples graph API

Leandro Nunes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 08:52:29 PDT 2017


leandron created this revision.

Fixes the way field_index is generated for a given field_name.

Make sure it uses the same list as the graph api will use to recover the information afterwards.


https://reviews.llvm.org/D37339

Files:
  lnt/server/ui/views.py


Index: lnt/server/ui/views.py
===================================================================
--- lnt/server/ui/views.py
+++ lnt/server/ui/views.py
@@ -699,14 +699,13 @@
         abort(404, "Could not find sample id: {}".format(sample_id))
 
     # Get the field index we are interested in.
-    field = None
-    for f in target_sample.get_primary_fields():
+    field_index = None
+    for idx, f in enumerate(ts.sample_fields):
         if f.name == field_name:
-            field = f
+            field_index = idx
             break
-    if not field:
+    if not field_index:
         abort(400, "Could not find field {}".format(field_name))
-    field_index = field.index
 
     kwargs = {'plot.0': '{machine_id}.{test_id}.{field_id}'.format(
         machine_id=target_sample.run.machine.id,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37339.113412.patch
Type: text/x-patch
Size: 804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170831/0e9b7b98/attachment.bin>


More information about the llvm-commits mailing list