Package ClusterShell :: Module Event :: Class EventHandler
[hide private]
[frames] | no frames]

Class EventHandler

source code


ClusterShell EventHandler interface.

Derived class should implement the following methods to listen for Worker, EngineTimer or EnginePort chosen events.

Instance Methods [hide private]
 
ev_start(self, worker)
Called to indicate that a worker has just started.
source code
 
ev_pickup(self, worker)
Called to indicate that a worker command for a specific node (or key) has just started.
source code
 
ev_read(self, worker)
Called to indicate that a worker has data to read from a specific node (or key).
source code
 
ev_error(self, worker)
Called to indicate that a worker has error to read on stderr from a specific node (or key).
source code
 
ev_written(self, worker, node, sname, size)
Called to indicate that some writing has been done by the worker to a node on a given stream.
source code
 
ev_hup(self, worker)
Called to indicate that a worker command for a specific node (or key) has just finished.
source code
 
ev_timeout(self, worker)
Called to indicate that a worker has timed out (worker timeout only).
source code
 
ev_close(self, worker)
Called to indicate that a worker has just finished (it may already have failed on timeout).
source code
 
ev_msg(self, port, msg)
Called to indicate that a message has been received on an EnginePort.
source code
 
ev_timer(self, timer)
Called to indicate that a timer is firing.
source code
 
_ev_routing(self, worker, arg)
Routing event (private).
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

ev_start(self, worker)

source code 

Called to indicate that a worker has just started.

:param worker: :class:`.Worker` object

ev_pickup(self, worker)

source code 

Called to indicate that a worker command for a specific node (or key) has just started. Called for each node.

:param worker: :class:`.Worker` object

Available worker attributes:

* :attr:`.Worker.current_node` - node (or key)

ev_read(self, worker)

source code 

Called to indicate that a worker has data to read from a specific node (or key).

:param worker: :class:`.Worker` object

Available worker attributes:

* :attr:`.Worker.current_node` - node (or key) * :attr:`.Worker.current_msg` - read message

ev_error(self, worker)

source code 

Called to indicate that a worker has error to read on stderr from a specific node (or key).

:param worker: :class:`.Worker` object

Available worker attributes:

* :attr:`.Worker.current_node` - node (or key) * :attr:`.Worker.current_errmsg` - read error message

ev_written(self, worker, node, sname, size)

source code 

Called to indicate that some writing has been done by the worker to a
node on a given stream. This event is only generated when ``write()``
is previously called on the worker.

This handler may be called very often depending on the number of target
nodes, the amount of data to write and the block size used by the
worker.

Note: up to ClusterShell 1.6, this event handler wasn't implemented. To
properly handle ev_written after 1.6, the method signature must consist
of the following parameters:

:param worker: :class:`.Worker` object
:param node: node (or) key
:param sname: stream name
:param size: amount of bytes that has just been written to node/stream
    associated with this event

ev_hup(self, worker)

source code 

Called to indicate that a worker command for a specific node (or key) has just finished. Called for each node.

:param worker: :class:`.Worker` object

Available worker attributes:

* :attr:`.Worker.current_node` - node (or key) * :attr:`.Worker.current_rc` - command return code

ev_timeout(self, worker)

source code 

Called to indicate that a worker has timed out (worker timeout only).

:param worker: :class:`.Worker` object

ev_close(self, worker)

source code 

Called to indicate that a worker has just finished (it may already have failed on timeout).

:param worker: :class:`.Worker` object

ev_msg(self, port, msg)

source code 

Called to indicate that a message has been received on an EnginePort.

Used to deliver messages reliably between tasks.

:param port: EnginePort object on which a message has been received :param msg: the message object received

ev_timer(self, timer)

source code 

Called to indicate that a timer is firing.

:param timer: :class:`.EngineTimer` object that is firing

_ev_routing(self, worker, arg)

source code 

Routing event (private). Called to indicate that a (meta)worker has just updated one of its route path. You can safely ignore this event.