ExecWorker

class ClusterShell.Worker.Exec.ExecWorker(nodes, handler, timeout=None, **kwargs)

ClusterShell simple execution worker Class.

It runs commands locally. If a node list is provided, one command will be launched for each node and specific keywords will be replaced based on node name and rank.

Local shell usage example:

>>> worker = ExecWorker(nodeset, handler=MyEventHandler(),
...                     timeout=30, command="/bin/uptime")
>>> task.schedule(worker)   # schedule worker for execution
>>> task.run()              # run

Local copy usage example:

>>> worker = ExecWorker(nodeset, handler=MyEventHandler(),
...                     source="/etc/my.cnf",
...                     dest="/etc/my.cnf.bak")
>>> task.schedule(worker)      # schedule worker for execution
>>> task.run()                 # run

connect_timeout option is ignored by this worker.

COPY_CLASS

alias of CopyClient

SHELL_CLASS

alias of ExecClient

__init__(nodes, handler, timeout=None, **kwargs)

Create an ExecWorker and its engine client instances.

abort()

Abort processing any action by this worker.

set_write_eof(sname=None)

Tell worker to close its writer file descriptors once flushed. Do not perform writes after this call.

write(buf, sname=None)

Write to worker clients.

class ClusterShell.Worker.Exec.ExecClient(node, command, worker, stderr, timeout, autoclose=False, rank=None)

Run a simple local command.

Useful as a superclass for other more specific workers.

__init__(node, command, worker, stderr, timeout, autoclose=False, rank=None)

Create an EngineClient-type instance to locally run `command’.

Parameters:node – will be used as key.