class documentation

Undocumented

Method __call__ Undocumented
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method begin_rpc Run a registered function remotely with Resonate and returns a handle.
Method begin_run Run a registered function asynchronously with Resonate.
Method options Configure invocation options for a registered function.
Method rpc Run a registered function remotely with Resonate and waits for the result.
Method run Run a registered function with Resonate and waits for the result.
Class Variable __name__ Undocumented
Class Variable __type_params__ Undocumented
Property func Undocumented
Property name Undocumented
Instance Variable _func Undocumented
Instance Variable _name Undocumented
Instance Variable _opts Undocumented
Instance Variable _resonate Undocumented
def __call__(self, ctx: Context, *args: P.args, **kwargs: P.kwargs) -> R:

Undocumented

def __eq__(self, other: object) -> bool:

Undocumented

def __hash__(self) -> int:

Undocumented

def __init__(self, resonate: Resonate, name: str, func: Callable[Concatenate[Context, P], R], opts: Options):

Undocumented

def begin_rpc(self: Function[P, Generator[Any, Any, T] | T], id: str, *args: P.args, **kwargs: P.kwargs) -> Handle[T]:

Run a registered function remotely with Resonate and returns a handle.

This method schedules the specified function for remote execution under a durable promise identified by the given id. The function runs on a remote worker or process as part of the distributed execution environment.

Unlike Function.rpc, this method is non-blocking and immediately returns a Handle[T] object that can be awaited or queried later to retrieve the final result once remote execution completes.

If a durable promise with the same id already exists, Resonate subscribes to its result or returns it immediately if it has already completed. Duplicate executions for the same id are automatically prevented, ensuring idempotent and consistent behavior.

Parameters
id:strThe unique identifier of the durable promise. Reusing an ID ensures idempotent remote execution.
*args:P.argsPositional arguments passed to the function.
**kwargs:P.kwargsKeyword arguments passed to the function.
Returns
Handle[T]A handle representing the asynchronous remote execution. The handle can be awaited or inspected for completion and results.
def begin_run(self: Function[P, Generator[Any, Any, T] | T], id: str, *args: P.args, **kwargs: P.kwargs) -> Handle[T]:

Run a registered function asynchronously with Resonate.

This method schedules the function for execution under a durable promise identified by the given id. If a promise with the same id already exists, Resonate subscribes to its result or returns it immediately if it has completed.

Unlike Function.run, this method is non-blocking and returns a handle (Handle[T]) that can be awaited or queried later for the final result.

Duplicate executions for the same id are automatically prevented, ensuring idempotent and consistent behavior across distributed runs.

Parameters
id:strThe unique identifier of the durable promise. Reusing an ID ensures idempotent execution.
*args:P.argsPositional arguments passed to the function.
**kwargs:P.kwargsKeyword arguments passed to the function.
Returns
Handle[T]A handle representing the asynchronous execution. The handle can be awaited or inspected for status and results.
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) -> Function[P, R]:

Configure invocation options for a registered function.

This method allows fine-grained control over how a function is invoked, including encoding, idempotency behavior, retry strategy, timeout policy, and targeting.

These options modify the metadata and runtime behavior of the function without altering its implementation. They can be applied directly or through decorators to customize invocation semantics for specific workloads.

Parameters
encoder:Encoder[Any, str | None], optionalCustom data encoder used for serializing inputs or outputs.
idempotency_key:str | Callable[[str], str], optionalExplicit key or a callable that derives an idempotency key from the promise ID. Ensures repeated invocations with the same key reuse prior results.
retry_policy:RetryPolicy | Callable[[Callable], RetryPolicy], optionalRetry strategy defining how failed invocations are retried. Common options include exponential, constant, linear, or never.
tags:dict[str, str], optionalMetadata tags applied to the durable promise representing the invocation. Useful for tracing and filtering.
target:str, optionalThe target node, worker group, or endpoint to route the invocation to.
timeout:float, optionalMaximum number of seconds before the invocation times out. If None, no timeout is enforced.
version:int, optionalSpecific version of the function to invoke. Useful for staged rollouts or backward compatibility.
Returns
Function[P, R]The function configured with the specified invocation options.
def rpc(self: Function[P, Generator[Any, Any, T] | T], id: str, *args: P.args, **kwargs: P.kwargs) -> T:

Run a registered function remotely with Resonate and waits for the result.

This method executes the specified function on a remote worker or process under a durable promise identified by the given id. If a promise with the same id already exists, Resonate subscribes to its result or returns it immediately if it has already completed.

This is a blocking operation, and execution will not continue until the remote function completes and returns its result.

Duplicate executions for the same id are automatically prevented, ensuring idempotent and consistent behavior across distributed runs.

Parameters
id:strThe unique identifier of the durable promise. Reusing an ID ensures idempotent remote execution.
*args:P.argsPositional arguments passed to the function.
**kwargs:P.kwargsKeyword arguments passed to the function.
Returns
TThe final result returned from the remote function execution.
def run(self: Function[P, Generator[Any, Any, T] | T], id: str, *args: P.args, **kwargs: P.kwargs) -> T:

Run a registered function with Resonate and waits for the result.

This method executes the specified function under a durable promise identified by the given id. If a promise with the same id already exists, Resonate subscribes to its result or returns it immediately if it has completed.

Duplicate executions for the same id are automatically prevented, ensuring idempotent and consistent behavior across distributed runs.

This is a blocking operation—execution will not continue until the function result is available.

Parameters
id:strThe unique identifier of the durable promise. Reusing an ID ensures idempotent execution.
*args:P.argsPositional arguments passed to the function.
**kwargs:P.kwargsKeyword arguments passed to the function.
Returns
TThe final result of the executed function.
__name__: str =

Undocumented

__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] =

Undocumented

@property
func: Callable[Concatenate[Context, P], R] =

Undocumented

@property
name: str =

Undocumented

_func =

Undocumented

_name =

Undocumented

_opts =

Undocumented

_resonate =

Undocumented