1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 """
22 ClusterShell Event handling.
23
24 This module contains the base class **EventHandler** which defines a simple
25 interface through methods to handle events coming from ClusterShell I/O Engine
26 clients. Events are generated by Worker, EngineTimer or EnginePort objects.
27 """
28
30 """ClusterShell EventHandler interface.
31
32 Derived class should implement the following methods to listen for Worker,
33 EngineTimer or EnginePort chosen events.
34 """
35
37 """
38 Called to indicate that a worker has just started.
39
40 :param worker: :class:`.Worker` object
41 """
42
44 """
45 Called to indicate that a worker command for a specific node (or key)
46 has just started. Called for each node.
47
48 :param worker: :class:`.Worker` object
49
50 Available worker attributes:
51
52 * :attr:`.Worker.current_node` - node (or key)
53 """
54
56 """
57 Called to indicate that a worker has data to read from a specific
58 node (or key).
59
60 :param worker: :class:`.Worker` object
61
62 Available worker attributes:
63
64 * :attr:`.Worker.current_node` - node (or key)
65 * :attr:`.Worker.current_msg` - read message
66 """
67
69 """
70 Called to indicate that a worker has error to read on stderr from
71 a specific node (or key).
72
73 :param worker: :class:`.Worker` object
74
75 Available worker attributes:
76
77 * :attr:`.Worker.current_node` - node (or key)
78 * :attr:`.Worker.current_errmsg` - read error message
79 """
80
82 """
83 Called to indicate that some writing has been done by the worker to a
84 node on a given stream. This event is only generated when ``write()``
85 is previously called on the worker.
86
87 This handler may be called very often depending on the number of target
88 nodes, the amount of data to write and the block size used by the
89 worker.
90
91 Note: up to ClusterShell 1.6, this event handler wasn't implemented. To
92 properly handle ev_written after 1.6, the method signature must consist
93 of the following parameters:
94
95 :param worker: :class:`.Worker` object
96 :param node: node (or) key
97 :param sname: stream name
98 :param size: amount of bytes that has just been written to node/stream
99 associated with this event
100 """
101
103 """
104 Called to indicate that a worker command for a specific node (or key)
105 has just finished. Called for each node.
106
107 :param worker: :class:`.Worker` object
108
109 Available worker attributes:
110
111 * :attr:`.Worker.current_node` - node (or key)
112 * :attr:`.Worker.current_rc` - command return code
113 """
114
116 """
117 Called to indicate that a worker has timed out (worker timeout only).
118
119 :param worker: :class:`.Worker` object
120 """
121
123 """
124 Called to indicate that a worker has just finished (it may already
125 have failed on timeout).
126
127 :param worker: :class:`.Worker` object
128 """
129
131 """
132 Called to indicate that a message has been received on an EnginePort.
133
134 Used to deliver messages reliably between tasks.
135
136 :param port: EnginePort object on which a message has been received
137 :param msg: the message object received
138 """
139
141 """
142 Called to indicate that a timer is firing.
143
144 :param timer: :class:`.EngineTimer` object that is firing
145 """
146
148 """
149 Routing event (private). Called to indicate that a (meta)worker has just
150 updated one of its route path. You can safely ignore this event.
151 """
152