Commit 6b1151f7 authored by Paul Graydon's avatar Paul Graydon

wendelin_telecom_base: Improve KPI calculation error handling

parent 71d02c8d
...@@ -7,24 +7,32 @@ def load_measurements(alogm): ...@@ -7,24 +7,32 @@ def load_measurements(alogm):
try: try:
measurement = alogm.read() measurement = alogm.read()
while measurement is not None: while measurement is not None:
mlog.append(measurement) try:
mlog.append(measurement)
except AssertionError:
# Invalid measurement: simply skip it
pass
measurement = alogm.read() measurement = alogm.read()
finally: finally:
alogm.close() alogm.close()
return mlog return mlog
def calc_periods(mlog, tperiod): def calc_periods(mlog, tperiod):
t = mlog.data()[0]['X.Tstart'] try:
for measurement in mlog.data()[1:]: t = mlog.data()[0]['X.Tstart']
t_ = measurement['X.Tstart'] for measurement in mlog.data()[1:]:
if (t_ - t) >= tperiod: t_ = measurement['X.Tstart']
calc = kpi.Calc(mlog, t, t + tperiod) if (t_ - t) >= tperiod:
t = calc.tau_hi calc = kpi.Calc(mlog, t, t + tperiod)
yield calc t = calc.tau_hi
yield calc
except IndexError:
# No data to read: exit
return
def getOrsKpiValues(data): def getOrsKpiValues(data):
fxlog = io.StringIO(data) fxlog = io.StringIO(data)
alogm = amari_kpi.LogMeasure(fxlog, open('/dev/null', 'r')) alogm = amari_kpi.LogMeasure(fxlog, open('/dev/null', 'r'))
mlog = load_measurements(alogm) mlog = load_measurements(alogm)
vt = [] vt = []
......
...@@ -37,12 +37,7 @@ for array in out_array: ...@@ -37,12 +37,7 @@ for array in out_array:
if array['variation'] == 'e_utran': if array['variation'] == 'e_utran':
e_utran_data_array = array['Data Array'] e_utran_data_array = array['Data Array']
try: vt, v_initial_epsb_estab_sr, v_added_epsb_estab_sr, evt, v_ip_throughput_qci = context.Base_getOrsKpiValues(log_data)
vt, v_initial_epsb_estab_sr, v_added_epsb_estab_sr, evt, v_ip_throughput_qci = context.Base_getOrsKpiValues(log_data)
except AssertionError:
# If some data is invalid: ignore data chunk and move on rather than crashing
progress_indicator.setIntOffsetIndex(end)
return
e_rab_dtype = np.dtype([ e_rab_dtype = np.dtype([
('vt', 'float'), ('vt', 'float'),
......
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