class Resonate:
Constructors: Resonate.local(dependencies, group, log_level, pid, ...)
, Resonate.remote(auth, dependencies, group, host, ...)
, Resonate(dependencies, group, log_level, message_source, ...)
Resonate client.
Class Method | local |
Create a Resonate client with local configuration. |
Class Method | remote |
Create a Resonate client with remote configuration. |
Method | __init__ |
Create a Resonate client. |
Method | begin |
Run a function with Resonate remotely. |
Method | begin |
Run a function with Resonate. |
Method | get |
Subscribe to an execution. |
Method | options |
Configure options for the function. |
Method | register |
Register function with Resonate. |
Method | rpc |
Run a function with Resonate remotely and wait for the result. |
Method | run |
Run a function with Resonate and wait for the result. |
Method | set |
Store a named dependency for use with Context . |
Method | start |
Explicitly start Resonate threads. |
Method | stop |
Stop resonate. |
Property | promises |
Promises low level client. |
Property | schedules |
Schedules low level client. |
Instance Variable | _bridge |
Undocumented |
Instance Variable | _dependencies |
Undocumented |
Instance Variable | _group |
Undocumented |
Instance Variable | _log |
Undocumented |
Instance Variable | _message |
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 |
Instance Variable | _workers |
Undocumented |
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, workers: int | None
= None) -> Resonate
:
¶
Create a Resonate client with local configuration.
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.
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, workers: int | None
= None) -> Resonate
:
¶
Create a Resonate client with remote configuration.
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.
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, workers: int | None
= None):
¶
Create a Resonate client.
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
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
Subscribe to an execution.
A durable promise with the same id must exist. Returns immediately if the promise has been completed.
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
:
¶
Configure options for the function.
- encoder: Configure your own data encoder.
- idempotency_key: Define the idempotency key invocation or a function that
- receives the promise id and creates an idempotency key.
- retry_policy: Define the retry policy: exponential | constant | linear | never
- tags: Add custom tags to the durable promise representing the invocation.
- target: Target to distribute the invocation.
- timeout: Number of seconds before the invocation timesout.
- version: Version of the function to invoke.
Callable[ Concatenate[ Context, P], R]
, /, *, name: str | None
= None, version: int
= 1) -> Function[ P, R]
: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.
str
, func: Callable[ Concatenate[ Context, P], Generator[ Any, Any, R] | R]
, *args: P.args
, **kwargs: P.kwargs
) -> R
:str
, func: str
, *args: Any
, **kwargs: Any
) -> Any
:Run a function with Resonate remotely and wait for the result.
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
- This is a blocking operation
str
, func: Callable[ Concatenate[ Context, P], Generator[ Any, Any, R] | R]
, *args: P.args
, **kwargs: P.kwargs
) -> R
:str
, func: str
, *args: Any
, **kwargs: Any
) -> Any
:Run a function with Resonate and wait for the result.
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
- This is a blocking operation