clustershell
clustershell copied to clipboard
Dynamic commands
I need to pass a unique ID to each of my processes in the remote nodes. For example,
./run.sh 0 ./run.sh 1 ./run.sh 2 ...
Is there a way to do it with clush now? I deal with a lot of nodes (30+), so this would be very helpful.
This can only be done using python code for now.
I can propose to you a ugly hack, using exec worker:
clush -R exec -w node[1-10] 'ssh %host ./run.sh %rank'
By Python code, do you mean the ClusterShell APIs? Or just Python?
I mean clustershell API (in Python :))
from ClusterShell.Task import NodeSet, task_self
for i, node in enumerate(NodeSet("foo[1-30]")):
task_self().shell("./run.sh %s" % i, nodes=node)
task_self().run()
(untested :))