Trending: Add more NFV tests
[csit.git] / resources / tools / presentation / generator_cpta.py
index 3003557..29eed8c 100644 (file)
@@ -169,7 +169,7 @@ def _generate_trending_traces(in_data, job_name, build_info,
     """
 
     data_x = list(in_data.keys())
-    data_y = list(in_data.values())
+    data_y = [float(item) / 1e6 for item in in_data.values()]
 
     hover_text = list()
     xaxis = list()
@@ -353,8 +353,15 @@ def _generate_all_charts(spec, input_data):
              f"{graph.get(u'title', u'')}."
             )
         )
-        data = input_data.filter_data(graph, continue_on_error=True)
-        if data is None:
+
+        if graph.get(u"include", None):
+            data = input_data.filter_tests_by_name(
+                graph, continue_on_error=True
+            )
+        else:
+            data = input_data.filter_data(graph, continue_on_error=True)
+
+        if data is None or data.empty:
             logging.error(u"No data.")
             return dict()
 
@@ -496,7 +503,7 @@ def _generate_all_charts(spec, input_data):
                 ])
 
             name_file = (
-                f"{spec.cpta[u'output-file']}-{graph[u'output-file-name']}"
+                f"{spec.cpta[u'output-file']}/{graph[u'output-file-name']}"
                 f"{spec.cpta[u'output-file-type']}")
 
             logs.append((u"INFO", f"    Writing the file {name_file} ..."))
@@ -549,18 +556,18 @@ def _generate_all_charts(spec, input_data):
 
     anomaly_classifications = dict()
 
-    # Create the header:
+    # Create the table header:
     csv_tables = dict()
     for job_name in builds_dict:
         if csv_tables.get(job_name, None) is None:
             csv_tables[job_name] = list()
-        header = u"Build Number:," + u",".join(builds_dict[job_name]) + u'\n'
+        header = f"Build Number:,{u','.join(builds_dict[job_name])}\n"
         csv_tables[job_name].append(header)
         build_dates = [x[0] for x in build_info[job_name].values()]
-        header = u"Build Date:," + u",".join(build_dates) + u'\n'
+        header = f"Build Date:,{u','.join(build_dates)}\n"
         csv_tables[job_name].append(header)
         versions = [x[1] for x in build_info[job_name].values()]
-        header = u"Version:," + u",".join(versions) + u'\n'
+        header = f"Version:,{u','.join(versions)}\n"
         csv_tables[job_name].append(header)
 
     for chart in spec.cpta[u"plots"]:
@@ -576,7 +583,7 @@ def _generate_all_charts(spec, input_data):
 
     # Write the tables:
     for job_name, csv_table in csv_tables.items():
-        file_name = spec.cpta[u"output-file"] + u"-" + job_name + u"-trending"
+        file_name = f"{spec.cpta[u'output-file']}/{job_name}-trending"
         with open(f"{file_name}.csv", u"w") as file_handler:
             file_handler.writelines(csv_table)
 
@@ -611,7 +618,7 @@ def _generate_all_charts(spec, input_data):
         result = u"PASS"
         for job_name, job_data in anomaly_classifications.items():
             file_name = \
-                f"{spec.cpta[u'output-file']}-regressions-{job_name}.txt"
+                f"{spec.cpta[u'output-file']}/regressions-{job_name}.txt"
             with open(file_name, u'w') as txt_file:
                 for test_name, classification in job_data.items():
                     if classification == u"regression":
@@ -619,7 +626,7 @@ def _generate_all_charts(spec, input_data):
                     if classification in (u"regression", u"outlier"):
                         result = u"FAIL"
             file_name = \
-                f"{spec.cpta[u'output-file']}-progressions-{job_name}.txt"
+                f"{spec.cpta[u'output-file']}/progressions-{job_name}.txt"
             with open(file_name, u'w') as txt_file:
                 for test_name, classification in job_data.items():
                     if classification == u"progression":