/opt/alt/python38/lib/python3.8/site-packages/daemon/__pycache__
Edit: /opt/alt/python38/lib/python3.8/site-packages/daemon/__pycache__/runner.cpython-38.pyc (10128B)
U
{1`) @ s d Z ddlmZmZ ddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
mZmZmZ ze W n ek
r eZY nX eZede G dd d eZG d
d deeZG dd
d
eeZG dd deeZG dd dZdddZ dd Z!dd Z"dS )z Daemon runner library.
)absolute_importunicode_literalsN pidfile)0_chain_exception_from_existing_exception_context
DaemonContext
basestringunicodeu@ The ‘runner’ module is not a supported API for this library.c s( e Zd ZdZ fddZdd Z ZS )DaemonRunnerErrorz3 Abstract base class for errors from DaemonRunner. c s | t j|| d S )N)_chain_from_contextsuper__init__)selfargskwargs __class__ >/opt/alt/python38/lib/python3.8/site-packages/daemon/runner.pyr 2 s zDaemonRunnerError.__init__c C s t | dd d S )NTas_causer r r r r r 7 s z%DaemonRunnerError._chain_from_context)__name__
__module____qualname____doc__r r
__classcell__r r r r r / s r c @ s e Zd ZdZdd ZdS )DaemonRunnerInvalidActionErrorz; Raised when specified action for DaemonRunner is invalid. c C s t | dd d S )NFr r r r r r r > s z2DaemonRunnerInvalidActionError._chain_from_contextN)r r r r r r r r r r ; s r c @ s e Zd ZdZdS )DaemonRunnerStartFailureErrorz, Raised when failure starting DaemonRunner. Nr r r r r r r r r C s r c @ s e Zd ZdZdS )DaemonRunnerStopFailureErrorz, Raised when failure stopping DaemonRunner. Nr! r r r r r" G s r" c @ sr e Zd ZdZdZdd Zdd Zdd Zdd
dZdd
Z dd Z
dd Zdd Ze eedZ
dd Zdd Zd S )DaemonRunnera4 Controller for a callable running in a separate background process.
The first command-line argument is the action to take:
* 'start': Become a daemon and call `app.run()`.
* 'stop': Exit the daemon process specified in the PID file.
* 'restart': Stop, then start.
zstarted with pid {pid:d}c C sN | || _t | _| | d| _|jdk r@t|j|j| _| j| j_dS )a# Set up the parameters of a new runner.
:param app: The application instance; see below.
:return: ``None``.
The `app` argument must have the following attributes:
* `stdin_path`, `stdout_path`, `stderr_path`: Filesystem paths
to open and replace the existing `sys.stdin`, `sys.stdout`,
`sys.stderr`.
* `pidfile_path`: Absolute filesystem path to a file that will
be used as the PID file for the daemon. If ``None``, no PID
file will be used.
* `pidfile_timeout`: Used as the default acquisition timeout
value supplied to the runner's PID lock file.
* `run`: Callable that will be invoked when the daemon is
started.
N)
parse_argsappr daemon_context#_open_streams_from_app_stream_pathsr Zpidfile_pathmake_pidlockfileZpidfile_timeoutr r% r r r r X s
zDaemonRunner.__init__c C s8 t |jd| j_t |jd| j_t |jddd| j_dS )ab Open the `daemon_context` streams from the paths specified.
:param app: The application instance.
Open the `daemon_context` standard streams (`stdin`,
`stdout`, `stderr`) as stream objects of the appropriate
types, from each of the corresponding filesystem paths
from the `app`.
rtzw+tr ) bufferingN)openZ
stdin_pathr&