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: ServiceT, debug: bool = False, quiet: bool = False, log_level: Severity = 20, log_file: str | os.PathLike | IO | None = None, log_handlers: Iterable[Handler] | None = None, redirect_stdouts: bool = True, redirect_stdouts_level: Severity = 30, stdout: IO | None = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, stderr: IO | None = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, override_logging: bool = True, logging_config: dict | None = None, console_port: int = 50101, blocking_timeout: Seconds = 10.0, daemon: bool = True, loop: asyncio.AbstractEventLoop | None = None, **kwargs: Any)¶
Start mode service from the command-line.
- BLOCK_DETECTOR: ClassVar[str] = 'mode.debug:BlockingDetector'¶
- async_exit_stack: AsyncExitStack¶
- property blocking_detector: BlockingDetector¶
- blocking_timeout: Seconds¶
- carp(msg: str) None ¶
Write warning to standard err.
- console_port: int¶
- debug: bool¶
- async default_on_first_start() None ¶
- execute_from_commandline() NoReturn ¶
- exit_stack: ExitStack¶
- install_signal_handlers() None ¶
- log: CompositeLogger¶
- log_file: str | os.PathLike | IO | None¶
- log_handlers: list[Handler]¶
- log_level: Severity | None¶
- logger: logging.Logger = <Logger mode.worker (WARNING)>¶
- logging_config: dict | None¶
- async maybe_start_blockdetection() None ¶
- async on_execute() None ¶
- async on_first_start() None ¶
Service started for the first time in this process.
- on_setup_root_logger(logger: Logger, level: int) None ¶
- async on_started() None ¶
Service has started.
- on_worker_shutdown() None ¶
- quiet: bool¶
- redirect_stdouts: bool¶
- redirect_stdouts_level: int¶
- say(msg: str) None ¶
Write message to standard out.
- stderr: IO¶
- stdout: IO¶
- stop_and_shutdown() None ¶