class documentation

Undocumented

Class Method local Create a local Resonate client.
Class Method remote Create a remote Resonate client.
Method __init__ Create a Resonate client.
Method get Subscribe to an execution.
Method options Undocumented
Method register Register function with Resonate.
Method rpc Run a function with Resonate remotely.
Method run Run a function with Resonate.
Method set_dependency Store a named dependency for use with Context.
Method start Undocumented
Method stop Undocumented
Property promises Undocumented
Property schedules Undocumented
Instance Variable _bridge Undocumented
Instance Variable _dependencies Undocumented
Instance Variable _group Undocumented
Instance Variable _log_level Undocumented
Instance Variable _message_source Undocumented
Instance Variable _opts Undocumented
Instance Variable _pid Undocumented
Instance Variable _registry Undocumented
Instance Variable _started Undocumented
Instance Variable _store Undocumented
Instance Variable _ttl Undocumented
@classmethod
def local(cls, dependencies: Dependencies | None = None, group: str = 'default', log_level: int | Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = logging.INFO, pid: str | None = None, registry: Registry | None = None, ttl: int = 10) -> Resonate:

Create a local Resonate client.

This configuration stores all state in memory, with no external persistence or network I/O. The in memory store implements the same API as the remote store, making it perfect for rapid development, local testing, and experimentation.

@classmethod
def remote(cls, auth: tuple[str, str] | None = None, dependencies: Dependencies | None = None, group: str = 'default', host: str | None = None, log_level: int | Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = logging.INFO, message_source_port: str | None = None, pid: str | None = None, registry: Registry | None = None, store_port: str | None = None, ttl: int = 10) -> Resonate:

Create a remote Resonate client.

This configuration persists all state to a remote store, enabling full durability, coordination, and recovery protocols across processes.

The remote store implementation is ideal for production workloads, fault-tolerant scheduling, and distributed execution.

def __init__(self, *, dependencies: Dependencies | None = None, group: str = 'default', log_level: int | Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] = logging.NOTSET, message_source: MessageSource | None = None, pid: str | None = None, registry: Registry | None = None, store: Store | None = None, ttl: int = 10):

Create a Resonate client.

def get(self, id: str) -> Handle[Any]:

Subscribe to an execution.

A durable promise with the same id must exist. Returns immediately if the promise has been completed.

def options(self, *, encoder: Encoder[Any, str | None] | None = None, idempotency_key: str | Callable[[str], str] | None = None, retry_policy: RetryPolicy | Callable[[Callable], RetryPolicy] | None = None, tags: dict[str, str] | None = None, target: str | None = None, timeout: float | None = None, version: int | None = None) -> Resonate:

Undocumented

@overload
def register(self, func: Callable[Concatenate[Context, P], R], /, *, name: str | None = None, version: int = 1) -> Function[P, R]:
@overload
def register(self, *, name: str | None = None, version: int = 1) -> Callable[[Callable[Concatenate[Context, P], R]], Function[P, R]]:

Register function with Resonate.

This method makes the provided function available for top level execution under the specified name and version.

It can be used directly by passing the target function, or as a decorator.

When used without arguments, the function itself is decorated and registered with the default name (derived from the function) and version. Providing a name or version allows explicit control over the function identifier and its versioning for subsequent invocations.

@overload
def rpc(self, id: str, func: Callable[Concatenate[Context, P], Generator[Any, Any, R] | R], *args: P.args, **kwargs: P.kwargs) -> Handle[R]:
@overload
def rpc(self, id: str, func: str, *args: Any, **kwargs: Any) -> Handle[Any]:

Run a function with Resonate remotely.

If a durable promise with the same id already exists, the method will subscribe to its result or return the value immediately if the promise has been completed.

Resonate will prevent duplicate executions for the same id.

  • Function must be registered
  • Function args and kwargs must be serializable
@overload
def run(self, id: str, func: Callable[Concatenate[Context, P], Generator[Any, Any, R] | R], *args: P.args, **kwargs: P.kwargs) -> Handle[R]:
@overload
def run(self, id: str, func: str, *args: Any, **kwargs: Any) -> Handle[Any]:

Run a function with Resonate.

If a durable promise with the same id already exists, the method will subscribe to its result or return the value immediately if the promise has been completed.

Resonate will prevent duplicate executions for the same id.

  • Function must be registered
  • Function args and kwargs must be serializable
def set_dependency(self, name: str, obj: Any):

Store a named dependency for use with Context.

The dependency is made available to all functions via their execution Context.

def start(self):

Undocumented

def stop(self):

Undocumented

@property
promises: PromiseStore =

Undocumented

@property
schedules: ScheduleStore =

Undocumented

_bridge =

Undocumented

_dependencies =

Undocumented

_group =

Undocumented

_log_level =

Undocumented

_message_source =

Undocumented

_opts =

Undocumented

_pid =

Undocumented

_registry =

Undocumented

_started: bool =

Undocumented

_store =

Undocumented

_ttl =

Undocumented