Package ClusterShell :: Package Worker :: Module Pdsh :: Class WorkerPdsh
[hide private]
[frames] | no frames]

Class WorkerPdsh

source code



ClusterShell pdsh-based worker Class.

Remote Shell (pdsh) usage example:
    worker = WorkerPdsh(nodeset, handler=MyEventHandler(),
                    timeout=30, command="/bin/hostname")
Remote Copy (pdcp) usage example: 
    worker = WorkerPdsh(nodeset, handler=MyEventHandler(),
                    timeout=30, source="/etc/my.conf",
                    dest="/etc/my.conf")
    ...
    task.schedule(worker)   # schedule worker for execution
    ...
    task.resume()           # run

Known Limitations:
    * write() is not supported by WorkerPdsh
    * return codes == 0 are not garanteed when a timeout is used (rc > 0
      are fine)

Instance Methods [hide private]
 
__init__(self, nodes, handler, timeout, **kwargs)
Initialize Pdsh worker instance.
source code
 
_engine_clients(self)
Return a list of underlying engine clients.
source code
 
_start(self)
Start worker, initialize buffers, prepare command.
source code
 
reader_fileno(self)
Return the reader file descriptor as an integer.
source code
 
writer_fileno(self)
Return the writer file descriptor as an integer.
source code
 
_read(self, size=-1)
Read data from process.
source code
 
write(self, buf)
Write data to process.
source code
 
_close(self, force, timeout)
Close worker.
source code
 
_handle_read(self)
Engine is telling us a read is available.
source code
 
_on_node_rc(self, node, rc)
Return code received from a node, update last* stuffs.
source code

Inherited from EngineClient.EngineClient: abort

Inherited from Engine.Engine.EngineBaseTimer: invalidate, is_valid, set_nextfire

Inherited from Engine.Engine.EngineBaseTimer (private): _set_engine

Inherited from Worker.DistantWorker: iter_buffers, iter_keys_timeout, iter_node_buffers, iter_node_retcodes, iter_retcodes, last_node, last_read, last_retcode, node_buffer, node_rc, num_timeout

Inherited from Worker.Worker: did_timeout

Inherited from Worker.Worker (private): _invoke, _set_task

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, nodes, handler, timeout, **kwargs)
(Constructor)

source code 

Initialize Pdsh worker instance.

Overrides: object.__init__

_engine_clients(self)

source code 

Return a list of underlying engine clients.

Overrides: Worker.Worker._engine_clients
(inherited documentation)

_start(self)

source code 

Start worker, initialize buffers, prepare command.

Overrides: Worker.Worker._start

reader_fileno(self)

source code 

Return the reader file descriptor as an integer.

Overrides: EngineClient.EngineClient.reader_fileno

writer_fileno(self)

source code 

Return the writer file descriptor as an integer.

Overrides: EngineClient.EngineClient.writer_fileno

write(self, buf)

source code 

Write data to process. Not supported with Pdsh worker.

_close(self, force, timeout)

source code 

Close worker. Called by engine after worker has been unregistered. This method should handle all termination types (normal, forced or on timeout).

Overrides: EngineClient.EngineClient._close

_handle_read(self)

source code 

Engine is telling us a read is available.

Overrides: EngineClient.EngineClient._handle_read

_on_node_rc(self, node, rc)

source code 

Return code received from a node, update last* stuffs.

Overrides: Worker.DistantWorker._on_node_rc