From 3c0a48aacea94e78a977a3edea919b741df19995 Mon Sep 17 00:00:00 2001 From: Yulia Portnova Date: Tue, 9 Feb 2016 13:27:45 +0200 Subject: [PATCH] simulator.py improvements Added fanout option to target Fixed timeout option Removed setting config values as they are reverted to defaults on driver load Change-Id: Ia2d8a7bbcb04706deb3d701c1a0f93a0dd835a19 --- tools/simulator.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/simulator.py b/tools/simulator.py index 872ac0edd..df6ef81f3 100755 --- a/tools/simulator.py +++ b/tools/simulator.py @@ -363,7 +363,7 @@ def main(): help='number of call per threads') client.add_argument('-w', dest='wait_after_msg', type=int, default=-1, help='sleep time between two messages') - client.add_argument('-t', dest='timeout', type=int, default=3, + client.add_argument('--timeout', dest='timeout', type=int, default=3, help='client timeout') server = subparsers.add_parser('rpc-server') @@ -381,13 +381,15 @@ def main(): help='number of call per threads') client.add_argument('-w', dest='wait_after_msg', type=int, default=-1, help='sleep time between two messages') - client.add_argument('-t', dest='timeout', type=int, default=3, + client.add_argument('--timeout', dest='timeout', type=int, default=3, help='client timeout') client.add_argument('--exit-wait', dest='exit_wait', type=int, default=0, help='Keep connections open N seconds after calls ' 'have been done') client.add_argument('--is-cast', dest='is_cast', type=bool, default=False, help='Use `call` or `cast` RPC methods') + client.add_argument('--is-fanout', dest='is_fanout', type=bool, + default=False, help='fanout=True for CAST messages') args = parser.parse_args() @@ -401,8 +403,6 @@ def main(): else: transport = messaging.get_notification_transport(cfg.CONF, url=args.url) - cfg.CONF.oslo_messaging_notifications.topics = "notif" - cfg.CONF.oslo_messaging_notifications.driver = "messaging" # oslo.config defaults cfg.CONF.heartbeat_interval = 5 @@ -426,8 +426,9 @@ def main(): init_msg(args.messages) targets = [target.partition('.')[::2] for target in args.targets] start = datetime.datetime.now() - targets = [messaging.Target(topic=topic, server=server_name) for topic, - server_name in targets] + targets = [messaging.Target( + topic=topic, server=server_name, fanout=args.is_fanout) for + topic, server_name in targets] spawn_rpc_clients(args.threads, transport, targets, args.wait_after_msg, args.timeout, args.is_cast, args.messages, args.duration)