Trending: weekly comparison - workaround
[csit.git] / resources / tools / presentation / generator_tables.py
index 82e59c4..b09b820 100644 (file)
@@ -2176,8 +2176,10 @@ def table_weekly_comparison(table, in_data):
             header[1].insert(
                 1, in_data.metadata(job_name, build_nr).get(u"generated", u"")
             )
+            logging.info(
+                in_data.metadata(job_name, build_nr).get(u"version", u"ERROR"))
             header[0].insert(
-                1, in_data.metadata(job_name, build_nr).get(u"version", u"")
+                1, in_data.metadata(job_name, build_nr).get("version", build_nr)
             )
 
             for tst_name, tst_data in build.items():
@@ -2219,9 +2221,7 @@ def table_weekly_comparison(table, in_data):
             if ref_data is None or cmp_data is None:
                 cmp_dict[tst_name].append(float(u'nan'))
             else:
-                cmp_dict[tst_name].append(
-                    relative_change(ref_data, cmp_data)
-                )
+                cmp_dict[tst_name].append(relative_change(ref_data, cmp_data))
 
     tbl_lst_none = list()
     tbl_lst = list()
@@ -2281,13 +2281,15 @@ def table_weekly_comparison(table, in_data):
 
     # Reorganize header in txt table
     txt_table = list()
-    with open(txt_file_name, u"rt", encoding='utf-8') as file_handler:
-        for line in list(file_handler):
-            txt_table.append(line)
     try:
+        with open(txt_file_name, u"rt", encoding='utf-8') as file_handler:
+            for line in list(file_handler):
+                txt_table.append(line)
         txt_table.insert(5, txt_table.pop(2))
         with open(txt_file_name, u"wt", encoding='utf-8') as file_handler:
             file_handler.writelines(txt_table)
+    except FileNotFoundError as err:
+        logging.error(repr(err))
     except IndexError:
         pass