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: Optional[IO] = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, stderr: Optional[IO] = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>, console_port: int = 50101, loghandlers: List[logging.Handler] = None, blocking_timeout: Union[datetime.timedelta, float, str] = 10.0, loop: asyncio.events.AbstractEventLoop = None, override_logging: bool = True, daemon: bool = True, **kwargs: Any)¶ Start mode service from the command-line.
-
BLOCK_DETECTOR
: ClassVar[str] = 'mode.debug:BlockingDetector'¶
-
services
: Iterable[ServiceT] = None¶
-
debug
: bool = None¶
-
quiet
: bool = None¶
-
logging_config
: Optional[Dict] = None¶
-
loglevel
: Optional[Union[str, int]] = None¶
-
logfile
: Optional[Union[str, IO]] = None¶
-
loghandlers
: List[Handler] = None¶
-
redirect_stdouts
: bool = None¶
-
redirect_stdouts_level
: int = None¶
-
stdout
: IO = None¶
-
stderr
: IO = None¶
-
console_port
: int = None¶
-
blocking_timeout
: Seconds = None¶
-
say
(msg: str) → None¶ Write message to standard out.
-
carp
(msg: str) → None¶ Write warning to standard err.
-
on_init_dependencies
() → Iterable[mode.types.services.ServiceT]¶ Return list of service dependencies for this service.
-
async
on_first_start
() → None¶ Service started for the first time in this process.
-
async
default_on_first_start
() → None¶
-
async
on_execute
() → None¶
-
on_setup_root_logger
(logger: logging.Logger, level: int) → None¶
-
async
maybe_start_blockdetection
() → None¶
-
install_signal_handlers
() → None¶
-
logger
= <Logger mode.worker (WARNING)>¶
-
execute_from_commandline
() → NoReturn¶
-
on_worker_shutdown
() → None¶
-
stop_and_shutdown
() → None¶
-
async
on_started
() → None¶ Service has started.
-
property
blocking_detector
¶
-