Fix simulator stat printing
Change-Id: I97f05f64475541ec9269c17644cb27b46ef4f1cf
This commit is contained in:
parent
7f4826737d
commit
d522fcd981
@ -386,6 +386,19 @@ def generate_messages(messages_count):
|
|||||||
LOG.info("Messages has been prepared")
|
LOG.info("Messages has been prepared")
|
||||||
|
|
||||||
|
|
||||||
|
def wrap_sigexit(f):
|
||||||
|
def inner(*args, **kwargs):
|
||||||
|
try:
|
||||||
|
return f(*args, **kwargs)
|
||||||
|
except SignalExit as e:
|
||||||
|
LOG.info('Signal %s is caught. Interrupting the execution',
|
||||||
|
e.signo)
|
||||||
|
for server in SERVERS:
|
||||||
|
server.stop()
|
||||||
|
return inner
|
||||||
|
|
||||||
|
|
||||||
|
@wrap_sigexit
|
||||||
def run_server(server, duration=None):
|
def run_server(server, duration=None):
|
||||||
global IS_RUNNING
|
global IS_RUNNING
|
||||||
SERVERS.append(server)
|
SERVERS.append(server)
|
||||||
@ -412,6 +425,7 @@ def rpc_server(transport, target, wait_before_answer, executor, duration):
|
|||||||
return server.dispatcher.endpoints[0]
|
return server.dispatcher.endpoints[0]
|
||||||
|
|
||||||
|
|
||||||
|
@wrap_sigexit
|
||||||
def spawn_rpc_clients(threads, transport, targets, wait_after_msg, timeout,
|
def spawn_rpc_clients(threads, transport, targets, wait_after_msg, timeout,
|
||||||
is_cast, messages_count, duration):
|
is_cast, messages_count, duration):
|
||||||
p = eventlet.GreenPool(size=threads)
|
p = eventlet.GreenPool(size=threads)
|
||||||
@ -425,6 +439,7 @@ def spawn_rpc_clients(threads, transport, targets, wait_after_msg, timeout,
|
|||||||
p.waitall()
|
p.waitall()
|
||||||
|
|
||||||
|
|
||||||
|
@wrap_sigexit
|
||||||
def spawn_notify_clients(threads, topic, transport, message_count,
|
def spawn_notify_clients(threads, topic, transport, message_count,
|
||||||
wait_after_msg, timeout, duration):
|
wait_after_msg, timeout, duration):
|
||||||
p = eventlet.GreenPool(size=threads)
|
p = eventlet.GreenPool(size=threads)
|
||||||
@ -652,7 +667,6 @@ def main():
|
|||||||
signal.signal(signal.SIGTERM, signal_handler)
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
try:
|
|
||||||
if args.mode == 'rpc-server':
|
if args.mode == 'rpc-server':
|
||||||
target = messaging.Target(topic=args.topic, server=args.server)
|
target = messaging.Target(topic=args.topic, server=args.server)
|
||||||
if args.url.startswith('zmq'):
|
if args.url.startswith('zmq'):
|
||||||
@ -694,10 +708,6 @@ def main():
|
|||||||
if args.exit_wait:
|
if args.exit_wait:
|
||||||
LOG.info("Finished. waiting for %d seconds", args.exit_wait)
|
LOG.info("Finished. waiting for %d seconds", args.exit_wait)
|
||||||
time.sleep(args.exit_wait)
|
time.sleep(args.exit_wait)
|
||||||
except SignalExit as e:
|
|
||||||
LOG.info('Signal %s is caught. Interrupting the execution', e.signo)
|
|
||||||
for server in SERVERS:
|
|
||||||
server.stop()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user