fix(ci): cosmetic fix for parallel display
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
This commit is contained in:
@@ -43,7 +43,7 @@ import logging
|
|||||||
import datetime
|
import datetime
|
||||||
import signal
|
import signal
|
||||||
import statistics as stat
|
import statistics as stat
|
||||||
from multiprocessing import SimpleQueue
|
from multiprocessing import SimpleQueue, Lock
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
|
|
||||||
#import our libs
|
#import our libs
|
||||||
@@ -494,7 +494,7 @@ class OaiCiTest():
|
|||||||
messages = [f.result() for f in futures]
|
messages = [f.result() for f in futures]
|
||||||
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
|
||||||
|
|
||||||
def Ping_common(self, EPC, ue, RAN):
|
def Ping_common(self, EPC, ue, RAN, printLock):
|
||||||
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
|
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
|
||||||
ping_status = 0
|
ping_status = 0
|
||||||
ueIP = ue.getIP()
|
ueIP = ue.getIP()
|
||||||
@@ -551,6 +551,8 @@ class OaiCiTest():
|
|||||||
avg_msg = f'RTT(Avg) : {rtt_avg} ms'
|
avg_msg = f'RTT(Avg) : {rtt_avg} ms'
|
||||||
max_msg = f'RTT(Max) : {rtt_max} ms'
|
max_msg = f'RTT(Max) : {rtt_max} ms'
|
||||||
|
|
||||||
|
# adding a lock for cleaner display in command line
|
||||||
|
printLock.acquire()
|
||||||
logging.info(f'\u001B[1;37;44m ping result for {ue_header} \u001B[0m')
|
logging.info(f'\u001B[1;37;44m ping result for {ue_header} \u001B[0m')
|
||||||
logging.info(f'\u001B[1;34m {pal_msg} \u001B[0m')
|
logging.info(f'\u001B[1;34m {pal_msg} \u001B[0m')
|
||||||
logging.info(f'\u001B[1;34m {min_msg} \u001B[0m')
|
logging.info(f'\u001B[1;34m {min_msg} \u001B[0m')
|
||||||
@@ -563,6 +565,7 @@ class OaiCiTest():
|
|||||||
if float(packetloss) > float(self.ping_packetloss_threshold):
|
if float(packetloss) > float(self.ping_packetloss_threshold):
|
||||||
message += '\nPacket Loss too high'
|
message += '\nPacket Loss too high'
|
||||||
logging.error(f'\u001B[1;37;41m Packet Loss too high; Target: {self.ping_packetloss_threshold}%\u001B[0m')
|
logging.error(f'\u001B[1;37;41m Packet Loss too high; Target: {self.ping_packetloss_threshold}%\u001B[0m')
|
||||||
|
printLock.release()
|
||||||
return (False, message)
|
return (False, message)
|
||||||
elif float(packetloss) > 0:
|
elif float(packetloss) > 0:
|
||||||
message += '\nPacket Loss is not 0%'
|
message += '\nPacket Loss is not 0%'
|
||||||
@@ -573,7 +576,9 @@ class OaiCiTest():
|
|||||||
ping_rttavg_error_msg = f'RTT(Avg) too high: {rtt_avg} ms; Target: {self.ping_rttavg_threshold} ms'
|
ping_rttavg_error_msg = f'RTT(Avg) too high: {rtt_avg} ms; Target: {self.ping_rttavg_threshold} ms'
|
||||||
message += f'\n {ping_rttavg_error_msg}'
|
message += f'\n {ping_rttavg_error_msg}'
|
||||||
logging.error('\u001B[1;37;41m'+ ping_rttavg_error_msg +' \u001B[0m')
|
logging.error('\u001B[1;37;41m'+ ping_rttavg_error_msg +' \u001B[0m')
|
||||||
|
printLock.release()
|
||||||
return (False, message)
|
return (False, message)
|
||||||
|
printLock.release()
|
||||||
|
|
||||||
return (True, message)
|
return (True, message)
|
||||||
|
|
||||||
@@ -587,8 +592,9 @@ class OaiCiTest():
|
|||||||
|
|
||||||
ues = [cls_module_ue.Module_UE(n.strip()) for n in self.ue_ids]
|
ues = [cls_module_ue.Module_UE(n.strip()) for n in self.ue_ids]
|
||||||
logging.debug(ues)
|
logging.debug(ues)
|
||||||
|
pingLock = Lock()
|
||||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||||
futures = [executor.submit(self.Ping_common, EPC, ue, RAN) for ue in ues]
|
futures = [executor.submit(self.Ping_common, EPC, ue, RAN, pingLock) for ue in ues]
|
||||||
results = [f.result() for f in futures]
|
results = [f.result() for f in futures]
|
||||||
# each result in results is a tuple, first member goes to successes, second to messages
|
# each result in results is a tuple, first member goes to successes, second to messages
|
||||||
successes, messages = map(list, zip(*results))
|
successes, messages = map(list, zip(*results))
|
||||||
|
|||||||
Reference in New Issue
Block a user