l.s.t.p.ProcessMonitorProtocolWithTimeout(ProcessMonitorProtocol, TimeoutMixin) : class documentation

Part of lp.services.twistedsupport.processmonitor View In Hierarchy

Known subclasses: lp.codehosting.codeimport.workermonitor.CodeImportWorkerMonitorProtocol, lp.codehosting.puller.scheduler.PullerMonitorProtocol

Support for killing a monitored process after a period of inactivity.

Note that this class does not define activity in any way: your subclass should call the resetTimeout() from TimeoutMixin when it deems the subprocess has made progress.

Instance Variables_timeoutThe subprocess will be killed after this many seconds of inactivity.
Method __init__ Construct an instance of the protocol, for listening to a worker.
Method callLater Override TimeoutMixin.callLater so we use self._clock.
Method connectionMade Start the timeout counter when connection is made.
Method timeoutConnection When a timeout occurs, kill the process and record a TimeoutError.
Method processEnded See ProcessMonitorProtocol.processEnded.

Inherited from ProcessMonitorProtocol:

Method runNotification Run a given function in series with other notifications.
Method unexpectedError Something's gone wrong: kill the subprocess and report failure.

Inherited from ProcessProtocolWithTwoStageKill (via ProcessMonitorProtocol):

Method terminateProcess Terminate the process by SIGINT initially, but SIGKILL if needed.
Method _sigkill Forcefully kill the process.
def __init__(self, deferred, timeout, clock=None):
Construct an instance of the protocol, for listening to a worker.
ParametersdeferredPassed to ProcessMonitorProtocol.__init__.
timeoutThe subprocess will be killed after this many seconds of inactivity.
clockPassed to ProcessMonitorProtocol.__init__.
def callLater(self, period, func):
Override TimeoutMixin.callLater so we use self._clock.

This allows us to write unit tests that don't depend on actual wall clock time.

def connectionMade(self):
Start the timeout counter when connection is made.
def timeoutConnection(self):
When a timeout occurs, kill the process and record a TimeoutError.
def processEnded(self, reason):
See ProcessMonitorProtocol.processEnded.

Cancel the timeout, as the process no longer exists.

API Documentation for Launchpad, generated by pydoctor at 2018-02-25 00:00:04.