class documentation

class twisted.application.runner._pidfile.PIDFile: (source)

Implements interfaces: twisted.application.runner._pidfile.IPIDFile

View In Hierarchy

Concrete implementation of IPIDFile.

This implementation is presently not supported on non-POSIX platforms. Specifically, calling PIDFile.isRunning will raise NotImplementedError.

Method __init__
Instance Variable filePath Undocumented
Method read Read the process ID stored in this PID file.
Method writeRunningPID Store the PID of the current process in this PID file.
Method remove Remove this PID file.
Method isRunning Determine whether there is a running process corresponding to the PID in this PID file.
Method __enter__ Enter a context using this PIDFile.
Method __exit__ Exit a context using this PIDFile.
Class Variable _log Undocumented
Static Method _format Format a PID file's content.
Method _write Store a PID in this PID file.
Static Method _pidIsRunningPOSIX POSIX implementation for running process check.
_log = (source)

Undocumented

@staticmethod
def _format(pid): (source)

Format a PID file's content.

ParameterspidA process ID. (type: int)
ReturnsFormatted PID file contents. (type: bytes)
def __init__(self, filePath): (source)
ParametersfilePathThe path to the PID file on disk. (type: FilePath)
filePath = (source)

Undocumented

def read(self): (source)

Read the process ID stored in this PID file.

ReturnsThe contained process ID. (type: int)
RaisesNoPIDFoundIf this PID file does not exist.
EnvironmentErrorIf this PID file cannot be read.
ValueErrorIf this PID file's content is invalid.
def _write(self, pid): (source)

Store a PID in this PID file.

ParameterspidA PID to store. (type: int)
RaisesEnvironmentErrorIf this PID file cannot be written.
def writeRunningPID(self): (source)

Store the PID of the current process in this PID file.

RaisesEnvironmentErrorIf this PID file cannot be written.
def remove(self): (source)

Remove this PID file.

RaisesEnvironmentErrorIf this PID file cannot be removed.
def isRunning(self): (source)

Determine whether there is a running process corresponding to the PID in this PID file.

ReturnsTrue if this PID file contains a PID and a process with that PID is currently running; false otherwise. (type: bool)
RaisesEnvironmentErrorIf this PID file cannot be read.
InvalidPIDFileErrorIf this PID file's content is invalid.
StalePIDFileErrorIf this PID file's content refers to a PID for which there is no corresponding running process.
@staticmethod
def _pidIsRunningPOSIX(pid): (source)

POSIX implementation for running process check.

Determine whether there is a running process corresponding to the given PID.

ParameterspidThe PID to check. (type: int)
ReturnsTrue if the given PID is currently running; false otherwise. (type: bool)
RaisesEnvironmentErrorIf this PID file cannot be read.
InvalidPIDFileErrorIf this PID file's content is invalid.
StalePIDFileErrorIf this PID file's content refers to a PID for which there is no corresponding running process.
def __enter__(self): (source)

Enter a context using this PIDFile.

Writes the PID file with the PID of the running process.

ReturnsUndocumented (type: PIDFile)
RaisesAlreadyRunningErrorA process corresponding to the PID in this PID file is already running.
def __exit__(self, excType, excValue, traceback): (source)

Exit a context using this PIDFile.

Removes the PID file.

ParametersexcTypeUndocumented (type: Optional[Type[BaseException]])
excValueUndocumented (type: Optional[BaseException])
tracebackUndocumented (type: Optional[TracebackType])
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.