mode.worker

Worker - Starts services from the command-line.

Workers add signal handling, logging, and other things required to start and manage services in a process environment.

class mode.worker.Worker(*services: mode.types.services.ServiceT, debug: bool = False, quiet: bool = False, logging_config: Dict = None, loglevel: Union[str, int] = None, logfile: Union[str, IO] = None, redirect_stdouts: bool = True, redirect_stdouts_level: Union[int, str] = None, stdout: IO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, stderr: IO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>, console_port: int = 50101, loghandlers: List[logging.StreamHandler] = None, blocking_timeout: Union[datetime.timedelta, float, str] = 10.0, loop: asyncio.events.AbstractEventLoop = None, override_logging: bool = True, daemon: bool = True, **kwargs: Any)[source]

Start mode service from the command-line.

BLOCK_DETECTOR = 'mode.debug:BlockingDetector'
say(msg: str) → None[source]

Write message to standard out.

carp(msg: str) → None[source]

Write warning to standard err.

on_init_dependencies() → Iterable[mode.types.services.ServiceT][source]

Return list of service dependencies for this service.

async on_first_start() → None[source]

Service started for the first time in this process.

async default_on_first_start() → None[source]
async on_execute() → None[source]
on_setup_root_logger(logger: logging.Logger, level: int) → None[source]
async maybe_start_blockdetection() → None[source]
install_signal_handlers() → None[source]
logger = <Logger mode.worker (WARNING)>
execute_from_commandline() → NoReturn[source]
on_worker_shutdown() → None[source]
stop_and_shutdown() → None[source]
async on_started() → None[source]

Service has started.

property blocking_detector