Event

ClusterShell Event handling.

This module contains the base class EventHandler which defines a simple interface through methods to handle events coming from ClusterShell I/O Engine clients. Events are generated by Worker, EngineTimer or EnginePort objects.

class ClusterShell.Event.EventHandler

ClusterShell EventHandler interface.

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

ev_start(worker)

Called to indicate that a worker has just started.

Parameters:workerWorker object
ev_pickup(worker)

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

Parameters:workerWorker object

Available worker attributes:

ev_read(worker)

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

Parameters:workerWorker object

Available worker attributes:

ev_error(worker)

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

Parameters:workerWorker object

Available worker attributes:

ev_written(worker, node, sname, size)

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:

Parameters:
  • workerWorker object
  • node – node (or) key
  • sname – stream name
  • size – amount of bytes that has just been written to node/stream associated with this event
ev_hup(worker)

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

Parameters:workerWorker object

Available worker attributes:

ev_timeout(worker)

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

Parameters:workerWorker object
ev_close(worker)

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

Parameters:workerWorker object
ev_msg(port, msg)

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

Used to deliver messages reliably between tasks.

Parameters:
  • port – EnginePort object on which a message has been received
  • msg – the message object received
ev_timer(timer)

Called to indicate that a timer is firing.

Parameters:timerEngineTimer object that is firing