CSIT-1078: Optimize input data files download and processing
[csit.git] / resources / tools / presentation / generator_tables.py
index 0b92db6..38439ba 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2017 Cisco and/or its affiliates.
+# Copyright (c) 2018 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -730,13 +730,13 @@ def table_performance_trending_dashboard(table, input_data):
     data = input_data.filter_data(table, continue_on_error=True)
 
     # Prepare the header of the tables
-    header = ["Test Case",
+    header = ["        Test Case",
               "Trend [Mpps]",
-              "Short-Term Change [%]",
-              "Long-Term Change [%]",
-              "Regressions [#]",
-              "Progressions [#]",
-              "Outliers [#]"
+              "  Short-Term   Change [%]",
+              "  Long-Term   Change [%]",
+              "  Regressions [#]",
+              "  Progressions [#]",
+              "  Outliers [#]"
               ]
     header_str = ",".join(header) + "\n"
 
@@ -745,6 +745,8 @@ def table_performance_trending_dashboard(table, input_data):
     for job, builds in table["data"].items():
         for build in builds:
             for tst_name, tst_data in data[job][str(build)].iteritems():
+                if tst_name.lower() in table["ignore-list"]:
+                    continue
                 if tbl_dict.get(tst_name, None) is None:
                     name = "{0}-{1}".format(tst_data["parent"].split("-")[0],
                                             "-".join(tst_data["name"].
@@ -775,8 +777,9 @@ def table_performance_trending_dashboard(table, input_data):
             stdev_t = data_t.rolling(window=win_size, min_periods=2).std()
             median_first_idx = pd_data.size - long_win_size
             try:
-                max_median = max([x for x in median_t.values[median_first_idx:]
-                                  if not isnan(x)])
+                max_median = max(
+                    [x for x in median_t.values[median_first_idx:-win_size]
+                     if not isnan(x)])
             except ValueError:
                 max_median = nan
             try:
@@ -819,9 +822,6 @@ def table_performance_trending_dashboard(table, input_data):
                 rel_change_long = round(
                     ((last_median_t - max_median) / max_median) * 100, 2)
 
-            logging.info("rel_change_last : {}".format(rel_change_last))
-            logging.info("rel_change_long : {}".format(rel_change_long))
-
             tbl_lst.append(
                 [name,
                  '-' if isnan(last_median_t) else