Part of vmc.contrib.axiom.batch View In Hierarchy
Stateful class which tracks a Juice connection to a child process.
Communication occurs over stdin and stdout of the child process. The
process is launched and restarted as necessary. Failures due to the child
process terminating, either unilaterally of by request, are represented as
a transient exception class,
Mode is one of
'stopped' (no process running or starting)
'starting' (process begun but not ready for requests)
'ready' (process ready for requests)
'stopping' (process being torn down)
'waiting_ready' (process beginning but will be shut down
as soon as it starts up)
Transitions are as follows
getProcess:
stopped -> starting:
launch process
create/save in waitingForStartup/return Deferred
starting -> starting:
create/save/return Deferred
ready -> ready:
return saved process
stopping:
return failing Deferred indicating transient failure
waiting_ready:
return failing Deferred indicating transient failure
stopProcess:
stopped -> stopped:
return succeeding Deferred
starting -> waiting_ready:
create Deferred, add transient failure errback handler, return
ready -> stopping:
call shutdown on process
return Deferred which fires when shutdown is done
childProcessCreated:
starting -> ready:
callback saved Deferreds
clear saved Deferreds
waiting_ready:
errback saved Deferred indicating transient failure
return _shutdownIndexerProcess()
childProcessTerminated:
starting -> stopped:
errback saved Deferreds indicating transient failure
waiting_ready -> stopped:
errback saved Deferreds indicating transient failure
ready -> stopped:
drop reference to process object
stopping -> stopped:
Callback saved shutdown deferred
@ivar process: A reference to the process object. Set in every non-stopped
mode.
@ivar juice: A reference to the juice protocol. Set in all modes.
@ivar connector: A reference to the process protocol. Set in every
non-stopped mode.
@ivar onProcessStartup: None or a no-argument callable which will
be invoked whenever the connection is first established to a newly
spawned child process.
@ivar onProcessTermination: None or a no-argument callable which
will be invoked whenever a Juice connection is lost, except in the
case where process shutdown was explicitly requested via
stopProcess().
| Method | __init__ | Undocumented |
| Class | stopped | Undocumented |
| Class | starting | Undocumented |
| Class | ready | Undocumented |
| Class | stopping | Undocumented |
| Class | waiting_ready | Undocumented |