Commit 22a20f93 authored by hardy's avatar hardy

fix an error case where keys are missing

parent 0654f3fc
...@@ -161,6 +161,7 @@ def build_RT_Row(Branch,Commit,keys,filename): ...@@ -161,6 +161,7 @@ def build_RT_Row(Branch,Commit,keys,filename):
row.append(Branch) row.append(Branch)
row.append(Commit) row.append(Commit)
#parsing the log file
real_time_stats = {} real_time_stats = {}
f=open(filename,"r") f=open(filename,"r")
for line in f.readlines(): for line in f.readlines():
...@@ -171,14 +172,17 @@ def build_RT_Row(Branch,Commit,keys,filename): ...@@ -171,14 +172,17 @@ def build_RT_Row(Branch,Commit,keys,filename):
real_time_stats[k]=tmp.group(1) real_time_stats[k]=tmp.group(1)
f.close() f.close()
for k in keys: #parsing the dictionary with the keys we are looking for
tmp=re.match(r'^(?P<metric>.*):\s+(?P<avg>\d+\.\d+) us;\s+\d+;\s+(?P<max>\d+\.\d+) us;',real_time_stats[k]) #dict may be empty if no data found above
if tmp is not None: if len(real_time_stats)!=0:
metric=tmp.group('metric') for k in keys:
avg=tmp.group('avg') tmp=re.match(r'^(?P<metric>.*):\s+(?P<avg>\d+\.\d+) us;\s+\d+;\s+(?P<max>\d+\.\d+) us;',real_time_stats[k])
max=tmp.group('max') if tmp is not None:
row.append(float(avg)) metric=tmp.group('metric')
row.append(float(max)) avg=tmp.group('avg')
max=tmp.group('max')
row.append(float(avg))
row.append(float(max))
if len(row)==3: #if row was not updated (missing data for ex), then return an empty row if len(row)==3: #if row was not updated (missing data for ex), then return an empty row
row=[] row=[]
......
...@@ -934,6 +934,7 @@ class RANManagement(): ...@@ -934,6 +934,7 @@ class RANManagement():
htmleNBFailureMsg += statMsg htmleNBFailureMsg += statMsg
#data log of gNB rela time stats #data log of gNB rela time stats
#attention this leads to reading the log file a second time, not very efficient
import cls_rt_monitor #import here (rather than on top) is to avoid installing the libs onto 4G bench servers, possibly temporary solution import cls_rt_monitor #import here (rather than on top) is to avoid installing the libs onto 4G bench servers, possibly temporary solution
cls_rt_monitor.gNB_RT_monitor(self.ranBranch,self.ranCommitID, eNBlogFile) cls_rt_monitor.gNB_RT_monitor(self.ranBranch,self.ranCommitID, eNBlogFile)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment