[llvm-commits] [LNT] r161818 - in /lnt/trunk/lnt/server: db/testsuitedb.py ui/templates/v4_global_status.html ui/views.py

Michael Gottesman mgottesman at apple.com
Mon Aug 13 17:26:13 PDT 2012


Author: mgottesman
Date: Mon Aug 13 19:26:12 2012
New Revision: 161818

URL: http://llvm.org/viewvc/llvm-project?rev=161818&view=rev
Log:
[LNT] Added code to v4_global_status.html so that the proper css classes for the table to show/hide classes are generated.

Modified:
    lnt/trunk/lnt/server/db/testsuitedb.py
    lnt/trunk/lnt/server/ui/templates/v4_global_status.html
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=161818&r1=161817&r2=161818&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Mon Aug 13 19:26:12 2012
@@ -65,6 +65,7 @@
             fields = self.machine_fields
             id = Column("ID", Integer, primary_key=True)
             name = Column("Name", String(256), index=True)
+            _css_name = None
 
             # The parameters blob is used to store any additional information
             # reported by the run but not promoted into the machine record. Such
@@ -97,7 +98,14 @@
             @parameters.setter
             def parameters(self, data):
                 self.parameters_data = json.dumps(sorted(data.items()))
-
+            
+            def get_css_name(self):
+                """ Lazy method which returns a safe css name to
+                    represent this machine."""
+                if self._css_name is None:
+                    self._css_name = self.name.replace('.','-')
+                return self._css_name            
+            
             def get_baseline_run(self, revision=None):
                 """
                 Find the closest order to the requested baseline

Modified: lnt/trunk/lnt/server/ui/templates/v4_global_status.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_global_status.html?rev=161818&r1=161817&r2=161818&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_global_status.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_global_status.html Mon Aug 13 19:26:12 2012
@@ -8,6 +8,27 @@
               href="{{ url_for('.static', filename='v4_global_status.css') }}"></link>
         <script async src="{{ url_for('.static', filename='popup.js') }}"></script>
         <script async src="{{ url_for('.static', filename='sorttable.js') }}"></script>
+        
+        <style type="text/css">
+          {# Generate css classes to show/hide groups and machines #}
+          
+          {% for m in machines %}
+             table.hide-{{ m.get_css_name() }} td.{{ m.get_css_name() }},
+             table.hide-{{ m.get_css_name() }} th.{{ m.get_css_name() }},
+             table.hidenot-{{ m.get_css_name() }} td.not-{{ m.get_css_name() }},
+             table.hidenot-{{ m.get_css_name() }} th.not-{{ m.get_css_name() }} {
+                 display: none;
+             }
+          {% endfor %}
+          {% for group in groups %}
+             table.hide-{{group}} td.{{group}},
+             table.hide-{{group}} th.{{group}},
+             table.hidenot-{{group}} td.not-{{group}},
+             table.hidenot-{{group}} th.not-{{group}} {
+               display: none;
+             }
+          {% endfor %}
+        </style>
 {% endblock %}
 
 {% block title %}Global Status - {{
@@ -19,7 +40,7 @@
     <th class="label-header">Test</th>
     <th id="worst-time-header" class="data-header worst-time">Worst Time</th>
     {% for m in machines %}
-    <th class="data-header {{ machine_groups_map[m] }}">{{ m.name }}</th>
+    <th class="data-header {{ m.get_css_name() }} {{ machine_groups_map[m] }}">{{ m.name }}</th>
     {% endfor %}
   </tr>
   {% for row in tests %}
@@ -29,7 +50,7 @@
     </td>
     {{ row[1]|aspctcell("data-cell worst-time")|safe }}
     {% for cr in row[2:] %}
-       {{ cr.pct_delta|aspctcell("data-cell " + machine_groups_map[machines[loop.index0]])|safe }}
+      {{ cr.pct_delta|aspctcell("data-cell " + machines[loop.index0].get_css_name() + " " + machine_groups_map[machines[loop.index0]])|safe }}
     {% endfor %}
   </tr>
   {% endfor %}

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161818&r1=161817&r2=161818&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Mon Aug 13 19:26:12 2012
@@ -669,8 +669,9 @@
     machine_run_info = []
     reported_run_ids = []
 
-    # Create groupings based off of the names of our input machines.
-    grouping_set = set()
+    # Create groupings based off of the names of our input machines.    
+    grouping_set = set(['O3']) # Due to the default way we name our machines,
+                               # we need to add O3 since no O0/Os => O3.
     machine_groups_map = {}
     for machine in recent_machines:
         runs = recent_runs_by_machine[machine]
@@ -690,20 +691,21 @@
         machine_groups_map[machine] = machine_groupings
         grouping_set = grouping_set.union(machine_groupings)
 
-    # Invert machine name to groupings map and add in inverse names as classname with the not-prefix. This allows
-    # us to hide certain columns by changing the class on the table.
+    # Invert machine name to groupings map and add in inverse names as
+    # classname with the not-prefix. This allows us to hide certain
+    # columns by changing the class on the table.
     for machine in machine_groups_map:
         groups = machine_groups_map[machine]
-
-        # If a machine does not have O0 or Os in its name,
-        # we treat it as an O3 run. This is to be compatible
-        # with our current naming scheme.
+        
+        # If a machine does not have O0 or Os in its name, we treat it
+        # as an O3 run. This is to be compatible with our current
+        # naming scheme.
         if not 'O0' in groups and not 'Os' in groups:
             groups.append('O3')
-
+        
         # Add in inverse groups.
         groups.extend("not-" + x for x in grouping_set.difference(groups))
-
+        
         machine_groups_map[machine] = ' '.join(groups)
 
     # Get the set all tests reported in the recent runs.
@@ -741,6 +743,7 @@
                            tests=test_table,
                            machines=recent_machines,
                            machine_groups_map=machine_groups_map,
+                           groups = list(grouping_set),
                            selected_field=field)
 
 @v4_route("/daily_report/<int:year>/<int:month>/<int:day>")





More information about the llvm-commits mailing list