Search documentation

Type to search the documentation.

Generated API reference

classyak.Task

yak.Task

A declared callable that can submit remote Invocations.

A declared callable that can submit remote Invocations.

Python SDK reference · Yak 0.1.19release v0.1.19
provenancec2e8cf7c309abe376f390072b94a9ecd3e633080
method

Task.remote_async#

Submit an Invocation for this Task.

Submit an Invocation for this Task.

Signature
python
remote_async(*args: Any, **kwargs: Any) -> Invocation

Parameters#

NameTypeDefaultDescription
argsvariadic-positional Any —

Positional arguments

kwargsvariadic-keyword Any —

Keyword arguments passed to the user function unchanged

Returns#

Invocation

The accepted Invocation

Raises#

method

Task.with_options#

Return a remote wrapper with separate invocation configuration.

Return a remote wrapper with separate invocation configuration.

Signature
python
with_options(options: InvocationOptions) -> RemoteCallable

Parameters#

NameTypeDefaultDescription
optionspositional-or-keyword InvocationOptions —

Timeout options applied to invocations through the
returned wrapper.

Returns#

Task.remote

A remote callable that preserves the options outside the user's

method

Task.local#

Execute the function locally (synchronously).

Execute the function locally (synchronously).

Signature
python
local(*args: Any, **kwargs: Any) -> Any

Parameters#

NameTypeDefaultDescription
argsvariadic-positional Any —

Positional arguments

kwargsvariadic-keyword Any —

Keyword arguments

Returns#

Any

Task result

Raises#

  • RuntimeError

    If original function not available

property

Task.remote#

Get the remote callable for this Task.

Get the remote callable for this Task.

Returns#

Task.remote

Get the remote callable for this Task.

schema example
# Synchronous usage
result = my_func.remote(arg1, arg2)

# Asynchronous usage
result = await my_func.remote.aio(arg1, arg2)
method

Task.remote.with_options#

Return a callable with separate control-plane invocation options.

Return a callable with separate control-plane invocation options.

SignatureTask.remote.with_options
python
with_options(options: InvocationOptions) -> RemoteCallable

Parameters#

NameTypeDefaultDescription
optionspositional-or-keyword InvocationOptions —

Timeout options for calls made through the returned
callable.

Returns#

Task.remote

A remote callable that keeps control-plane options separate from

method

Task.remote#

Submit an Invocation for this Task and wait for its result.

Submit an Invocation for this Task and wait for its result.

SignatureTask.remote
python
Task.remote(*args: Any, **kwargs: Any) -> Any

Parameters#

NameTypeDefaultDescription
argsvariadic-positional Any —

Positional arguments

kwargsvariadic-keyword Any —

Keyword arguments

Returns#

Any

Task result (waits for completion)

Raises#

method

Task.remote.remote_async#

Submit an invocation and return its handle.

Submit an invocation and return its handle.

SignatureTask.remote.remote_async
python
remote_async(*args: Any, **kwargs: Any) -> Invocation

Parameters#

NameTypeDefaultDescription
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#

Invocation

A handle for the accepted remote invocation.

Raises#

method

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.

SignatureTask.remote.aio
python
aio(*args: Any, **kwargs: Any) -> Any

Parameters#

NameTypeDefaultDescription
argsvariadic-positional Any —

Positional arguments

kwargsvariadic-keyword Any —

Keyword arguments

Returns#

Any

Task result

Raises#

property

Task.map#

Get the map callable for this Task.

Get the map callable for this Task.

Returns#

Task.map

Get the map callable for this Task.

schema example
# 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)
method

Task.map#

Return a lazy synchronous map iterator.

Return a lazy synchronous map iterator.

SignatureTask.map
python
Task.map(*input_iterators: Any, kwargs: Optional[dict] = None, order_outputs: bool = True, return_exceptions: bool = False, max_in_flight: int = 32) -> MapIterator

Parameters#

NameTypeDefaultDescription
input_iteratorsvariadic-positional Any —

Equal-length iterators whose values are passed
positionally to each Invocation of this Task.

kwargskeyword-only Optional[dict] None

Keyword arguments shared by every invocation.

order_outputskeyword-only bool True

Yield results in input order when true; otherwise
yield each result as it completes.

return_exceptionskeyword-only bool False

Yield invocation exceptions instead of raising
the first one when true.

max_in_flightkeyword-only int 32

Maximum number of accepted invocations held in the
bounded window. Defaults to 32.

Returns#

MapIterator

A lazy synchronous iterator of Task results.

Raises#

  • ValueError

    If input lengths are provably unequal or
    max_in_flight is not positive.

method

Task.map.aio#

Return a lazy asynchronous map iterator.

Return a lazy asynchronous map iterator.

SignatureTask.map.aio
python
aio(*input_iterators: Any, kwargs: Optional[dict] = None, order_outputs: bool = True, return_exceptions: bool = False, max_in_flight: int = 32) -> AsyncMapIterator

Parameters#

NameTypeDefaultDescription
input_iteratorsvariadic-positional Any —

Equal-length iterators whose values are passed
positionally to each Invocation of this Task.

kwargskeyword-only Optional[dict] None

Keyword arguments shared by every invocation.

order_outputskeyword-only bool True

Yield results in input order when true; otherwise
yield each result as it completes.

return_exceptionskeyword-only bool False

Yield invocation exceptions instead of raising
the first one when true.

max_in_flightkeyword-only int 32

Maximum number of accepted invocations held in the
bounded window. Defaults to 32.

Returns#

AsyncMapIterator

A lazy asynchronous iterator of Task results.

Raises#

  • ValueError

    If input lengths are provably unequal or
    max_in_flight is not positive.

Related guides

Task execution Parallel Execution
BoundaryPreview limitations
  • 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.