from typing import Any, Callable, Dict, List, Optional, Tuple
version: str
__version__: str
class RestartPolicy:
def __init__(self, policy: str) -> None: ...
@staticmethod
def permanent() -> RestartPolicy:
@staticmethod
def temporary() -> RestartPolicy:
@staticmethod
def transient() -> RestartPolicy:
class RestartStrategy:
def __init__(self, strategy: str) -> None: ...
@staticmethod
def one_for_one() -> RestartStrategy:
@staticmethod
def one_for_all() -> RestartStrategy:
@staticmethod
def rest_for_one() -> RestartStrategy:
class RestartIntensity:
def __init__(self, max_restarts: int, within_seconds: int) -> None: ...
class ChildType:
def is_worker(self) -> bool: ...
def is_supervisor(self) -> bool: ...
class ChildExitReason:
def is_normal(self) -> bool: ...
def is_abnormal(self) -> bool: ...
def is_shutdown(self) -> bool: ...
class ChildInfo:
id: str
child_type: ChildType
restart_policy: Optional[RestartPolicy]
class ShouldStop:
def is_set(self) -> bool: ...
def __call__(self) -> bool: ...
def __bool__(self) -> bool: ...
class WorkerContext:
def __init__(self) -> None: ...
def get(self, key: str) -> Any: ...
def set(self, key: str, value: Any) -> None: ...
def delete(self, key: str) -> Any: ...
def contains_key(self, key: str) -> bool: ...
def len(self) -> int: ...
def is_empty(self) -> bool: ...
class MailboxConfig:
@staticmethod
def unbounded() -> MailboxConfig: ...
@staticmethod
def bounded(capacity: int) -> MailboxConfig: ...
class MailboxHandle:
def send(self, message: str) -> None:
def try_send(self, message: str) -> None:
def worker_id(self) -> str: ...
def is_open(self) -> bool: ...
class Mailbox:
def recv(self) -> Optional[str]:
def try_recv(self) -> str:
def mailbox(config: MailboxConfig) -> Tuple[MailboxHandle, Mailbox]: ...
def mailbox_named(
worker_id: str, config: MailboxConfig
) -> Tuple[MailboxHandle, Mailbox]: ...
class SupervisorSpec:
def __init__(self, name: str) -> None: ...
def with_restart_strategy(self, strategy: RestartStrategy) -> None: ...
def with_restart_intensity(self, intensity: RestartIntensity) -> None: ...
def with_restart_delay(self, seconds: float) -> None:
def with_restart_backoff(
self, initial_seconds: float, max_seconds: float
) -> None:
def with_shutdown_timeout(self, seconds: float) -> None:
def add_worker(
self,
id: str,
restart_policy: RestartPolicy,
worker_fn: Callable[..., Any],
) -> None:
def add_supervisor(self, supervisor: SupervisorSpec) -> None: ...
class SupervisorHandle:
@staticmethod
def start(spec: SupervisorSpec) -> SupervisorHandle: ...
def name(self) -> str: ...
def uptime(self) -> int:
def restart_strategy(self) -> RestartStrategy: ...
def which_children(self) -> List[ChildInfo]: ...
def count_children(self) -> Dict[str, int]: ...
def start_child(
self,
id: str,
restart_policy: RestartPolicy,
worker_fn: Callable[..., Any],
) -> str: ...
def start_child_linked(
self,
id: str,
restart_policy: RestartPolicy,
timeout_secs: int,
worker_fn: Callable[..., Any],
) -> str:
def terminate_child(self, child_id: str) -> None: ...
def shutdown(self) -> None: ...
class StatefulSupervisorSpec:
def __init__(self, name: str) -> None: ...
def with_restart_strategy(self, strategy: RestartStrategy) -> None: ...
def with_restart_intensity(self, intensity: RestartIntensity) -> None: ...
def with_shutdown_timeout(self, seconds: float) -> None: ...
def context(self) -> WorkerContext:
def add_worker(
self,
id: str,
restart_policy: RestartPolicy,
worker_fn: Callable[..., Any],
) -> None:
def add_supervisor(self, supervisor: StatefulSupervisorSpec) -> None: ...
class StatefulSupervisorHandle:
@staticmethod
def start(spec: StatefulSupervisorSpec) -> StatefulSupervisorHandle: ...
def name(self) -> str: ...
def which_children(self) -> List[ChildInfo]: ...
def count_children(self) -> Dict[str, int]: ...
def terminate_child(self, child_id: str) -> None: ...
def shutdown(self) -> None: ...
class SupervisorAddress:
@staticmethod
def tcp(addr: str) -> SupervisorAddress: ...
@staticmethod
def unix(path: str) -> SupervisorAddress: ...
class RemoteSupervisorHandle:
@staticmethod
def connect_tcp(addr: str) -> RemoteSupervisorHandle: ...
@staticmethod
def connect_unix(path: str) -> RemoteSupervisorHandle: ...
def which_children(self) -> List[ChildInfo]: ...
def terminate_child(self, child_id: str) -> None: ...
def shutdown(self) -> None: ...