Generated API reference
yak.Task
A declared callable that can submit remote Invocations.
A declared callable that can submit remote Invocations.
provenance
c2e8cf7c309abe376f390072b94a9ecd3e633080Task.remote_async#
Submit an Invocation for this Task.
Submit an Invocation for this Task.
remote_async(*args: Any, **kwargs: Any) -> Invocation
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
argsvariadic-positional |
Any |
— |
Positional arguments |
kwargsvariadic-keyword |
Any |
— |
Keyword arguments passed to the user function unchanged |
Returns#
InvocationThe accepted Invocation
Raises#
ConnectionErrorIf gRPC call fails
Task.with_options#
Return a remote wrapper with separate invocation configuration.
Return a remote wrapper with separate invocation configuration.
with_options(options: InvocationOptions) -> RemoteCallable
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
optionspositional-or-keyword |
InvocationOptions |
— |
Timeout options applied to invocations through the |
Returns#
Task.remoteA remote callable that preserves the options outside the user's
Task.local#
Execute the function locally (synchronously).
Execute the function locally (synchronously).
local(*args: Any, **kwargs: Any) -> Any
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
argsvariadic-positional |
Any |
— |
Positional arguments |
kwargsvariadic-keyword |
Any |
— |
Keyword arguments |
Returns#
AnyTask result
Raises#
RuntimeErrorIf original function not available
Task.remote#
Get the remote callable for this Task.
Get the remote callable for this Task.
Returns#
Task.remoteGet the remote callable for this Task.
# Synchronous usage
result = my_func.remote(arg1, arg2)
# Asynchronous usage
result = await my_func.remote.aio(arg1, arg2)
Task.remote.with_options#
Return a callable with separate control-plane invocation options.
Return a callable with separate control-plane invocation options.
Task.remote.with_optionswith_options(options: InvocationOptions) -> RemoteCallable
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
optionspositional-or-keyword |
InvocationOptions |
— |
Timeout options for calls made through the returned |
Returns#
Task.remoteA remote callable that keeps control-plane options separate from
Task.remote#
Submit an Invocation for this Task and wait for its result.
Submit an Invocation for this Task and wait for its result.
Task.remoteTask.remote(*args: Any, **kwargs: Any) -> Any
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
argsvariadic-positional |
Any |
— |
Positional arguments |
kwargsvariadic-keyword |
Any |
— |
Keyword arguments |
Returns#
AnyTask result (waits for completion)
Raises#
ConnectionErrorIf gRPC call fails
InvocationExecutionErrorIf the Invocation failed during execution
Task.remote.remote_async#
Submit an invocation and return its handle.
Submit an invocation and return its handle.
Task.remote.remote_asyncremote_async(*args: Any, **kwargs: Any) -> Invocation
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
argsvariadic-positional |
Any |
— |
Positional arguments passed to the Task's Python callable. |
kwargsvariadic-keyword |
Any |
— |
Keyword arguments passed to the Task's Python callable. |
Returns#
InvocationA handle for the accepted remote invocation.
Raises#
ConnectionErrorIf the invocation cannot be submitted.
Task.remote.aio#
Submit an Invocation for this Task and wait for its result asynchronously.
Submit an Invocation for this Task and wait for its result asynchronously.
Task.remote.aioaio(*args: Any, **kwargs: Any) -> Any
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
argsvariadic-positional |
Any |
— |
Positional arguments |
kwargsvariadic-keyword |
Any |
— |
Keyword arguments |
Returns#
AnyTask result
Raises#
ConnectionErrorIf gRPC call fails
InvocationExecutionErrorIf the Invocation failed during execution
Task.map#
Get the map callable for this Task.
Get the map callable for this Task.
Returns#
Task.mapGet the map callable for this Task.
# Synchronous usage
for result in my_func.map([1, 2, 3]):
print(result)
# Asynchronous usage
async for result in my_func.map.aio([1, 2, 3]):
print(result)
Task.map#
Return a lazy synchronous map iterator.
Return a lazy synchronous map iterator.
Task.mapTask.map(*input_iterators: Any, kwargs: Optional[dict] = None, order_outputs: bool = True, return_exceptions: bool = False, max_in_flight: int = 32) -> MapIterator
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
input_iteratorsvariadic-positional |
Any |
— |
Equal-length iterators whose values are passed |
kwargskeyword-only |
Optional[dict] |
None |
Keyword arguments shared by every invocation. |
order_outputskeyword-only |
bool |
True |
Yield results in input order when true; otherwise |
return_exceptionskeyword-only |
bool |
False |
Yield invocation exceptions instead of raising |
max_in_flightkeyword-only |
int |
32 |
Maximum number of accepted invocations held in the |
Returns#
MapIteratorA lazy synchronous iterator of Task results.
Raises#
ValueErrorIf input lengths are provably unequal or
max_in_flightis not positive.
Task.map.aio#
Return a lazy asynchronous map iterator.
Return a lazy asynchronous map iterator.
Task.map.aioaio(*input_iterators: Any, kwargs: Optional[dict] = None, order_outputs: bool = True, return_exceptions: bool = False, max_in_flight: int = 32) -> AsyncMapIterator
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
input_iteratorsvariadic-positional |
Any |
— |
Equal-length iterators whose values are passed |
kwargskeyword-only |
Optional[dict] |
None |
Keyword arguments shared by every invocation. |
order_outputskeyword-only |
bool |
True |
Yield results in input order when true; otherwise |
return_exceptionskeyword-only |
bool |
False |
Yield invocation exceptions instead of raising |
max_in_flightkeyword-only |
int |
32 |
Maximum number of accepted invocations held in the |
Returns#
AsyncMapIteratorA lazy asynchronous iterator of Task results.
Raises#
ValueErrorIf input lengths are provably unequal or
max_in_flightis not positive.
Related guides
- This page is generated from the pinned release schema; update the site pin when a new release should be documented.
- Lifecycle, persistence and operational context belong in the linked handwritten guides.