Skip to main content

TaskRunner

GitHub source

TaskRunner

evo.compute.tasks.common.runner.TaskRunner

Base class for compute task runners.

Subclass with concrete TParams and TResult type arguments and provide topic and task as class keyword arguments. The subclass is automatically registered with the :class:TaskRegistry.

Instances are awaitable: await runner submits the job, waits for completion, and returns the typed result with the execution context attached.

Example — defining a runner::

class KrigingRunner(
TaskRunner[KrigingParameters, KrigingResult],
topic="geostatistics",
task="kriging",
): ...

Example — advanced direct usage::

result = await KrigingRunner(context, params, preview=True)
df = await result.to_dataframe()

topic

topic: str

The compute topic (e.g. "geostatistics").

task

task: str

The task name within the topic (e.g. "kriging").

params_type

params_type: type[TParams]

The Pydantic parameters model, extracted automatically from the generic args.

result_model_type

result_model_type: type[TResultModel]

The Pydantic result model, extracted automatically from the generic args.

result_type

result_type: type[TResult]

The result type returned by the runner, typically a wrapper around the result model with convenience methods.

__call__

__call__() -> TResult

Submit the task, wait for completion, and return the typed result.

__await__

__await__() -> Generator[Any, None, TResult]

Make the runner directly awaitable: result = await Runner(ctx, params).

What is the reason for your feedback?