From f5889e70292399b7325206e79c0473d6e7f651c7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 6 Nov 2017 14:51:59 -0500 Subject: [PATCH] Add '-c' to manage noderun/nodeshell concurrency Allow user to specify custom parallel count. --- confluent_client/bin/noderun | 10 ++++++---- confluent_client/bin/nodeshell | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/confluent_client/bin/noderun b/confluent_client/bin/noderun index 02e22eac..19d8f133 100755 --- a/confluent_client/bin/noderun +++ b/confluent_client/bin/noderun @@ -37,18 +37,20 @@ import confluent.client as client def run(): - concurrentprocs = 168 - # among other things, FD_SETSIZE limits. Besides, spawning too many - # processes can be unkind for the unaware on memory pressure and such... argparser = optparse.OptionParser( - usage="Usage: %prog node commandexpression", + usage="Usage: %prog noderange commandexpression", epilog="Expressions are the same as in attributes, e.g. " "'ipmitool -H {hardwaremanagement.manager}' will be expanded.") + argparser.add_option('-c', '--count', type='int', default=168, + help='Number of commands to run at a time') + # among other things, FD_SETSIZE limits. Besides, spawning too many + # processes can be unkind for the unaware on memory pressure and such... argparser.disable_interspersed_args() (options, args) = argparser.parse_args() if len(args) < 2: argparser.print_help() sys.exit(1) + concurrentprocs = options.count c = client.Command() cmdstr = " ".join(args[1:]) diff --git a/confluent_client/bin/nodeshell b/confluent_client/bin/nodeshell index 061bc869..6b8f6200 100755 --- a/confluent_client/bin/nodeshell +++ b/confluent_client/bin/nodeshell @@ -36,18 +36,21 @@ import confluent.client as client def run(): - concurrentprocs = 168 - # among other things, FD_SETSIZE limits. Besides, spawning too many - # processes can be unkind for the unaware on memory pressure and such... + argparser = optparse.OptionParser( - usage="Usage: %prog node commandexpression", + usage="Usage: %prog noderange commandexpression", epilog="Expressions are the same as in attributes, e.g. " "'ipmitool -H {hardwaremanagement.manager}' will be expanded.") + argparser.add_option('-c', '--count', type='int', default=168, + help='Number of commands to run at a time') + # among other things, FD_SETSIZE limits. Besides, spawning too many + # processes can be unkind for the unaware on memory pressure and such... argparser.disable_interspersed_args() (options, args) = argparser.parse_args() if len(args) < 2: argparser.print_help() sys.exit(1) + concurrentprocs = options.count c = client.Command() cmdstr = " ".join(args[1:])