clustershell icon indicating copy to clipboard operation
clustershell copied to clipboard

Dynamic commands

Open ibalajiarun opened this issue 9 years ago • 3 comments

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.

ibalajiarun avatar Mar 31 '16 04:03 ibalajiarun

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'

degremont avatar Mar 31 '16 07:03 degremont

By Python code, do you mean the ClusterShell APIs? Or just Python?

ibalajiarun avatar Mar 31 '16 19:03 ibalajiarun

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 :))

degremont avatar Mar 31 '16 20:03 degremont