From e09c594ffbf2e2e41cd23771e74820b50f8f8ee9 Mon Sep 17 00:00:00 2001 From: erderial <71669104+erderial@users.noreply.github.com> Date: Thu, 29 Sep 2022 18:58:06 +0300 Subject: [PATCH 1/2] Adding wcons functionality for nodeconsole Adding wcons functionality for nodeconsole for xterm first. --- confluent_client/bin/nodeconsole | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/confluent_client/bin/nodeconsole b/confluent_client/bin/nodeconsole index be15c733..85e8eeb9 100755 --- a/confluent_client/bin/nodeconsole +++ b/confluent_client/bin/nodeconsole @@ -38,6 +38,8 @@ argparser.add_option('-t', '--tile', action='store_true', default=False, help='Tile console windows in the terminal') argparser.add_option('-l', '--log', action='store_true', default=False, help='Enter log replay mode instead of showing a live console') +argparser.add_option('-w','--wcons', action='store_true', default=False, + help='Enter wcons mode, opening xterm windows for every node') (options, args) = argparser.parse_args() if len(args) != 1: argparser.print_help() @@ -51,6 +53,20 @@ if options.log: sys.exit(1) logreader.replay_to_console(logname) sys.exit(0) +#added functionality for wcons +if options.wcons: + null = open('/dev/null', 'w') + nodes = [] + sess = client.Command() + for res in sess.read('/noderange/{0}/nodes/'.format(args[0])): + node = res.get('item', {}).get('href', '/').replace('/', '') + if not node: + sys.stderr.write(res.get('error', repr(res)) + '\n') + sys.exit(1) + nodes.append(node) + for node in sortutil.natural_sort(nodes): + subprocess.call(['xterm', '-e', 'nodeconsole', node]) +#end of wcons if options.tile: null = open('/dev/null', 'w') nodes = [] From e180ec0bc897930fc373e517717e5882b5001d4b Mon Sep 17 00:00:00 2001 From: erderial <71669104+erderial@users.noreply.github.com> Date: Thu, 29 Sep 2022 20:15:55 +0300 Subject: [PATCH 2/2] removed null from the flow --- confluent_client/bin/nodeconsole | 1 - 1 file changed, 1 deletion(-) diff --git a/confluent_client/bin/nodeconsole b/confluent_client/bin/nodeconsole index 85e8eeb9..ba0e7754 100755 --- a/confluent_client/bin/nodeconsole +++ b/confluent_client/bin/nodeconsole @@ -55,7 +55,6 @@ if options.log: sys.exit(0) #added functionality for wcons if options.wcons: - null = open('/dev/null', 'w') nodes = [] sess = client.Command() for res in sess.read('/noderange/{0}/nodes/'.format(args[0])):