From 354e545b8538b726a0bbd34ec5f9028c866fae9b Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Wed, 2 Feb 2022 16:45:37 -0700 Subject: [PATCH] lf_kpi_csv.py added comment to use the default columns. lf_kpi_csv.py added exception and traceback Signed-off-by: Chuck SmileyRekiere --- py-scripts/lf_kpi_csv.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/py-scripts/lf_kpi_csv.py b/py-scripts/lf_kpi_csv.py index 7f22a6c6..62de5c3b 100644 --- a/py-scripts/lf_kpi_csv.py +++ b/py-scripts/lf_kpi_csv.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 + """ NAME: lf_kpi_csv.py @@ -23,14 +24,15 @@ INCLUDE_IN_README import csv import time import argparse +import traceback ''' Note teh delimiter for the kpi.csv is a tab kpi.csv : specific file that is used for the database, dashboard and blog post -A blank entry is a valid entry in some cases. +A blank entry is a valid entry in some cases. - Date: date of run + Date: date of run test-rig : testbed that the tests are run on for example ct_us_001 test-tag : test specific information to differenciate the test, LANforge radios used, security modes (wpa2 , open) dut-hw-version : hardware version of the device under test @@ -49,6 +51,8 @@ A blank entry is a valid entry in some cases. ''' +# NOTE, Passing in _kpi_headers only used for testing. +# Do Not pass in headers , Please use the defaults class lf_kpi_csv: def __init__(self, # NOTE, Passing in _kpi_headers only used for testing. @@ -93,8 +97,9 @@ class lf_kpi_csv: self.kpi_file = open(kpifile, 'w') self.kpi_writer = csv.DictWriter(self.kpi_file, delimiter="\t", fieldnames=self.kpi_headers) self.kpi_writer.writeheader() - except: + except Exception as x: print("lf_kpi_csv.py: {} WARNING unable to open".format(self.kpi_file)) + traceback.print_exception(Exception, x, x.__traceback__, chain=True) self.kpi_dict = dict() self.kpi_dict['Date'] = '{date}'.format(date=int(time.time())) @@ -139,8 +144,8 @@ lf_kpi_csv.py Summary : --------- lf_kpi_csv.py library : - - Date: date of run + + Date: date of run test-rig : testbed that the tests are run on for example ct_us_001 test-tag : test specific information to differenciate the test, LANforge radios used, security modes (wpa2 , open) dut-hw-version : hardware version of the device under test @@ -155,10 +160,10 @@ lf_kpi_csv.py library : test-details : what was measured in the numeric-score, e.g. bits per second, bytes per second, upload speed, minimum cx time (ms) Units : units used for the numeric-scort Graph-Group - Items graphed together used by dashboard, For the lf_qa.py dashboard - + Example : - This module is included to assist in filling out the kpi.csv correctly + This module is included to assist in filling out the kpi.csv correctly The Unit test is used for helping to become familiar with the library ---------