lf_check.py : fixed table alignment

lf_qa.py : DUT at the beginning of the test run

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-08-10 12:07:54 -06:00
parent 3b39490be2
commit 109bdfa383
2 changed files with 37 additions and 13 deletions

View File

@@ -55,14 +55,35 @@ class csv_sqlite_dash():
self.plot_figure = [] self.plot_figure = []
self.children_div = [] self.children_div = []
self.html_results ="" self.html_results =""
self.server_html_reports = self.server + 'html-reports/' self.server_html_reports = self.server + 'html-reports/' #TODO : hard coded
self.server_started = False self.server_started = False
self.dut_model_num_list = "NA"
self.dut_sw_version_list = "NA"
self.dut_hw_version_list = "NA"
self.dut_serial_num_list = "NA"
self.app = dash.Dash(__name__, external_stylesheets=external_stylesheets) self.app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
# https://community.plotly.com/t/putting-a-dash-instance-inside-a-class/6097/3 # https://community.plotly.com/t/putting-a-dash-instance-inside-a-class/6097/3
#https://dash.plotly.com/dash-html-components/button #https://dash.plotly.com/dash-html-components/button
#self.app.callback(dash.dependencies.Output('container-button-basic', 'children'), #self.app.callback(dash.dependencies.Output('container-button-basic', 'children'),
# [dash.dependencies.Input(component_id ='submit-val', component_property ='n_clicks')])(self.show) # [dash.dependencies.Input(component_id ='submit-val', component_property ='n_clicks')])(self.show)
# Helper methods
def get_dut_info(self):
dut_info_df = pd.DataFrame()
#try:
dut_info_df['DUT'] = self.dut_model_num_list
dut_info_df['SW version'] = self.dut_sw_version_list[-1]
dut_info_df['HW version'] = self.dut_hw_version_list[-1]
dut_info_df['Serial'] = self.dut_serial_num_list[-1]
#except:
# dut_info_df['DUT'] = 'NA'
# dut_info_df['SW version'] = 'NA'
# dut_info_df['HW version'] = 'NA'
# dut_info_df['Serial'] = 'NA'
return dut_info_df
# information on sqlite database # information on sqlite database
# https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_sql.html # https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_sql.html
def store(self): def store(self):
@@ -125,11 +146,12 @@ class csv_sqlite_dash():
df_tmp = df_tmp.sort_values(by='Date') df_tmp = df_tmp.sort_values(by='Date')
test_id_list = list(df_tmp['test-id']) test_id_list = list(df_tmp['test-id'])
kpi_path_list = list(df_tmp['kpi_path']) kpi_path_list = list(df_tmp['kpi_path'])
# get Device Under Test Information # get Device Under Test Information ,
dut_model_num_list = list(df_tmp['dut-model-num']) # the set reduces the redundency , list puts it back into a list
dut_sw_version_list = list(df_tmp['dut-sw-version']) self.dut_model_num_list = list(set(list(df_tmp['dut-model-num'])))
dut_hw_version_list = list(df_tmp['dut-hw-version']) self.dut_sw_version_list = list(set(list(df_tmp['dut-sw-version'])))
dut_serial_num_list = list(df_tmp['dut-serial-num']) self.dut_hw_version_list = list(set(list(df_tmp['dut-hw-version'])))
self.dut_serial_num_list = list(set(list(df_tmp['dut-serial-num'])))
units_list = list(df_tmp['Units']) units_list = list(df_tmp['Units'])
print("GRAPHING::: test-rig {} test-tag {} Graph-Group {}".format(test_rig,test_tag,group)) print("GRAPHING::: test-rig {} test-tag {} Graph-Group {}".format(test_rig,test_tag,group))
@@ -138,8 +160,7 @@ class csv_sqlite_dash():
size_max=60)).update_traces(mode='lines+markers') size_max=60)).update_traces(mode='lines+markers')
kpi_fig.update_layout( kpi_fig.update_layout(
title="{} : {} : {} : {} : {} : {} : {} : {}".format(test_id_list[-1], group, test_tag, test_rig, title="{} : {} : {} : {}".format(test_id_list[-1], group, test_tag, test_rig),
dut_model_num_list[-1], dut_sw_version_list[-1],dut_hw_version_list[-1],dut_serial_num_list[-1]),
xaxis_title="Time", xaxis_title="Time",
yaxis_title="{}".format(units_list[-1]), yaxis_title="{}".format(units_list[-1]),
xaxis = {'type' : 'date'} xaxis = {'type' : 'date'}
@@ -282,7 +303,6 @@ Example: kpi_csv_sq.py --store --png --show --path <path to read kpi.csv> (read
parser.add_argument('--show', help='--show generate display and show dashboard, action store_true',action='store_true') parser.add_argument('--show', help='--show generate display and show dashboard, action store_true',action='store_true')
parser.add_argument('--dir', help="--dir <results directory> default lf_qa", default="lf_qa") parser.add_argument('--dir', help="--dir <results directory> default lf_qa", default="lf_qa")
args = parser.parse_args() args = parser.parse_args()
__path = args.path __path = args.path
@@ -325,7 +345,6 @@ Example: kpi_csv_sq.py --store --png --show --path <path to read kpi.csv> (read
#csv_results = "lf_qa-{}.csv".format(current_time) #csv_results = "lf_qa-{}.csv".format(current_time)
#csv_results = report.file_add_path(csv_results) #csv_results = report.file_add_path(csv_results)
csv_dash = csv_sqlite_dash( csv_dash = csv_sqlite_dash(
_path = __path, _path = __path,
_file = __file, _file = __file,
@@ -355,6 +374,12 @@ Example: kpi_csv_sq.py --store --png --show --path <path to read kpi.csv> (read
report_parent_path = report.get_parent_path() report_parent_path = report.get_parent_path()
report_parent_path = __server + report_parent_path.replace('/home/lanforge/','') report_parent_path = __server + report_parent_path.replace('/home/lanforge/','')
report.build_link(report_parent_path,"{}".format(report_parent_path)) report.build_link(report_parent_path,"{}".format(report_parent_path))
report.set_table_title("Device Under Test")
report.build_table_title()
dut_info_df = csv_dash.get_dut_info()
print("dut_info_df {}".format(dut_info_df))
report.set_table_dataframe(dut_info_df)
report.build_table()
report.set_table_title("QA Test Results") report.set_table_title("QA Test Results")
report.build_table_title() report.build_table_title()
# report.set_text("lanforge-scripts git sha: {}".format(git_sha)) # report.set_text("lanforge-scripts git sha: {}".format(git_sha))
@@ -374,7 +399,6 @@ Example: kpi_csv_sq.py --store --png --show --path <path to read kpi.csv> (read
#csv_dash.show(n_clicks) #csv_dash.show(n_clicks)
csv_dash.show() csv_dash.show()
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -1273,8 +1273,8 @@ Example :
report.start_content_div2() report.start_content_div2()
report.set_obj_html("Objective", "Run QA Tests") report.set_obj_html("Objective", "Run QA Tests")
report.build_objective() report.build_objective()
report.set_text("LANforge") report.set_table_title("LANForge")
report.build_text() report.build_table_title()
report.set_table_dataframe(lf_test_setup) report.set_table_dataframe(lf_test_setup)
report.build_table() report.build_table()
report.set_table_title("LF Check Test Results") report.set_table_title("LF Check Test Results")