Closed
Description
Worker
and Task
classes are becoming too complex and not flexible enough, we need to move some of the features managed there to event handlers. For example, feature #231 should be implemented using extended event handlers described in this ticket.
Indeed the original event handling mechanism is not flexible enough, so it must itself be changed. Some of the current limitations of Event.EventHandler are:
- access to
node
,msg
orrc
are done throughWorker.current_
accessors instead of directly accessible method arguments - the API do not support named Engine I/O streams (d3e23a6b0f8129118df09568c411a5eef1968117)
- ...
My proposal is to define a new module named Event2.py
defining a new EventHandler
base class.
Changes Event2.EventHandler
vs. Event.EventHandler
:
ev_error
is merged withev_read
which becomes "named stream aware"ev_read
andev_hup
get a full arguments list (other idea is to use**kwargs
but doesn't seem to be the more convenient solution):def ev_read(self, worker, node, fname, msg):
def ev_hup(self, worker, node, rc):
Change in Worker
:
Worker
detects the use of Event2.EventHandler and delegates further work to it, otherwise (V1) there is no change- when no handler is assigned to a
Worker
, useDefaultEventHandler
which supportsMsgTree
management (compat) CHANGED: DefaultEventHandler is indeed Event2.EventHandler
Change in user-programming:
- in
Event2.EventHandler
, parents method should be called if associated feature is wanted; this must be clearly documented - no change at all if user is still using Event.py
Included EventHandler V2:
DefaultEventHandler
(concrete) as a compat EventHandler (Task
's stdout/stderrMsgTree
support) CHANGED: DefaultEventHandler is indeed Event2.EventHandler- see if some of CLI/Clush.py could be generalized or a
ProgressEventHandler
?
[work in progress]