mode.supervisors

Supervisors.

Naming here is taken from Erlang ;-)

Don’t know supervisors? Read about them them here: http://learnyousomeerlang.com/supervisors

class mode.supervisors.ForfeitOneForAllSupervisor(*services: ~mode.types.services.ServiceT, max_restarts: ~typing.Union[~datetime.timedelta, int, float, str] = 100.0, over: ~typing.Union[~datetime.timedelta, int, float, str] = 1.0, raises: ~typing.Type[BaseException] = <class 'mode.exceptions.MaxRestartsExceeded'>, replacement: ~typing.Optional[~typing.Callable[[~mode.types.services.ServiceT, int], ~typing.Awaitable[~mode.types.services.ServiceT]]] = None, **kwargs: ~typing.Any)

If one service in the group crashes, we give up on all of them.

async_exit_stack: AsyncExitStack
diag: DiagT
exit_stack: ExitStack
log: CompositeLogger
logger: logging.Logger = <Logger mode.supervisors (WARNING)>
max_restarts: float
over: float
raises: Type[BaseException]
replacement: Optional[ReplacementT]
async restart_services(services: list[mode.types.services.ServiceT]) None
class mode.supervisors.ForfeitOneForOneSupervisor(*services: ~mode.types.services.ServiceT, max_restarts: ~typing.Union[~datetime.timedelta, int, float, str] = 100.0, over: ~typing.Union[~datetime.timedelta, int, float, str] = 1.0, raises: ~typing.Type[BaseException] = <class 'mode.exceptions.MaxRestartsExceeded'>, replacement: ~typing.Optional[~typing.Callable[[~mode.types.services.ServiceT, int], ~typing.Awaitable[~mode.types.services.ServiceT]]] = None, **kwargs: ~typing.Any)

Supervisor that if a service crashes, we do not restart it.

async_exit_stack: AsyncExitStack
diag: DiagT
exit_stack: ExitStack
log: CompositeLogger
logger: logging.Logger = <Logger mode.supervisors (WARNING)>
max_restarts: float
over: float
raises: Type[BaseException]
replacement: Optional[ReplacementT]
async restart_services(services: list[mode.types.services.ServiceT]) None
class mode.supervisors.OneForAllSupervisor(*services: ~mode.types.services.ServiceT, max_restarts: ~typing.Union[~datetime.timedelta, int, float, str] = 100.0, over: ~typing.Union[~datetime.timedelta, int, float, str] = 1.0, raises: ~typing.Type[BaseException] = <class 'mode.exceptions.MaxRestartsExceeded'>, replacement: ~typing.Optional[~typing.Callable[[~mode.types.services.ServiceT, int], ~typing.Awaitable[~mode.types.services.ServiceT]]] = None, **kwargs: ~typing.Any)

Supervisor that restarts all services when a service crashes.

async_exit_stack: AsyncExitStack
diag: DiagT
exit_stack: ExitStack
log: CompositeLogger
logger: logging.Logger = <Logger mode.supervisors (WARNING)>
max_restarts: float
over: float
raises: Type[BaseException]
replacement: Optional[ReplacementT]
async restart_services(services: list[mode.types.services.ServiceT]) None
class mode.supervisors.OneForOneSupervisor(*services: ~mode.types.services.ServiceT, max_restarts: ~typing.Union[~datetime.timedelta, int, float, str] = 100.0, over: ~typing.Union[~datetime.timedelta, int, float, str] = 1.0, raises: ~typing.Type[BaseException] = <class 'mode.exceptions.MaxRestartsExceeded'>, replacement: ~typing.Optional[~typing.Callable[[~mode.types.services.ServiceT, int], ~typing.Awaitable[~mode.types.services.ServiceT]]] = None, **kwargs: ~typing.Any)

Supervisor simply restarts any crashed service.

async_exit_stack: AsyncExitStack
diag: DiagT
exit_stack: ExitStack
log: CompositeLogger
logger: logging.Logger = <Logger mode.supervisors (WARNING)>
max_restarts: float
over: float
raises: Type[BaseException]
replacement: Optional[ReplacementT]
class mode.supervisors.SupervisorStrategy(*services: ~mode.types.services.ServiceT, max_restarts: ~typing.Union[~datetime.timedelta, int, float, str] = 100.0, over: ~typing.Union[~datetime.timedelta, int, float, str] = 1.0, raises: ~typing.Type[BaseException] = <class 'mode.exceptions.MaxRestartsExceeded'>, replacement: ~typing.Optional[~typing.Callable[[~mode.types.services.ServiceT, int], ~typing.Awaitable[~mode.types.services.ServiceT]]] = None, **kwargs: ~typing.Any)

Base class for all supervisor strategies.

add(*services: ServiceT) None
async_exit_stack: AsyncExitStack
diag: DiagT
discard(*services: ServiceT) None
exit_stack: ExitStack
insert(index: int, service: ServiceT) None
property label: str

Label used for graphs.

log: CompositeLogger
logger: logging.Logger = <Logger mode.supervisors (WARNING)>
max_restarts: float
async on_start() None

Service is starting.

async on_stop() None

Service is being stopped/restarted.

over: float
raises: Type[BaseException]
replacement: Optional[ReplacementT]
async restart_service(service: ServiceT) None
async restart_services(services: list[mode.types.services.ServiceT]) None
async run_until_complete() None
service_operational(service: ServiceT) bool
async start_service(service: ServiceT) None
async start_services(services: list[mode.types.services.ServiceT]) None
async stop_services(services: list[mode.types.services.ServiceT]) None
wakeup() None