X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_alerts.py;h=3c5c6f9feacf9640119b1e5984d7b4fce11e93fe;hp=d22e7aa9630c6383a5e26b2a739f399808804d01;hb=c65595288367e8e6f53d225812d55ca4d90cdab2;hpb=d24bcf6e10fdee8e6ba1a0ef2f75e69d9e9d0a40 diff --git a/resources/tools/presentation/generator_alerts.py b/resources/tools/presentation/generator_alerts.py index d22e7aa963..3c5c6f9fea 100644 --- a/resources/tools/presentation/generator_alerts.py +++ b/resources/tools/presentation/generator_alerts.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 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: @@ -279,6 +279,38 @@ class Alerting: line, error_msg = line[:-1].split(u'###', maxsplit=1) test = line.split(u'-') name = u'-'.join(test[3:-1]) + if len(error_msg) > 128: + if u";" in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u';', 1)[0]}..." + elif u":" in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u':', 1)[0]}..." + elif u"." in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u'.', 1)[0]}..." + elif u"?" in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u'?', 1)[0]}..." + elif u"!" in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u'!', 1)[0]}..." + elif u"," in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u',', 1)[0]}..." + elif u" " in error_msg[128:256]: + error_msg = \ + f"{error_msg[:128]}" \ + f"{error_msg[128:].split(u' ', 1)[0]}..." + else: + error_msg = error_msg[:128] + except ValueError: continue @@ -331,7 +363,7 @@ class Alerting: :param idx: Index of the test set as it is specified in the specification file. :param header: The header of the list of [re|pro]gressions. - :param re_pro: 'regression' or 'progression'. + :param re_pro: 'regressions' or 'progressions'. :type alert: dict :type idx: int :type header: str @@ -376,8 +408,8 @@ class Alerting: text = u"" - legend = (f"Legend:\n[ Last trend in Mpps | number of runs for " - f"last trend |") + legend = (f"Legend: Test-name NIC Frame-size Trend[Mpps] Runs[#] " + f"Long-Term change[%]") out_file = ( f"{self.configs[alert[u'way']][u'output-dir']}/" @@ -385,7 +417,7 @@ class Alerting: ) try: with open(out_file, u'w') as reg_file: - reg_file.write(f"{legend} regressions ]") + reg_file.write(legend) except IOError: logging.error(f"Not possible to write the file {out_file}.txt.") @@ -395,7 +427,7 @@ class Alerting: ) try: with open(out_file, u'w') as reg_file: - reg_file.write(f"{legend} progressions ]") + reg_file.write(legend) except IOError: logging.error(f"Not possible to write the file {out_file}.txt.") @@ -405,7 +437,7 @@ class Alerting: try: groups = re.search( re.compile( - r'((vpp|dpdk)-\dn-(skx|clx|tsh|dnv|zn2|tx2)-.*)' + r'((vpp|dpdk)-\dn-(skx|clx|tsh|dnv|zn2|tx2|icx|alt)-.*)' ), test_set )