bayesline.apiclient.AsyncTaskClient#

class bayesline.apiclient.AsyncTaskClient(client: AsyncApiClient, task_id: str, tqdm_progress: bool = False, exc_types: list[Type] | None = None) None#
__init__(client: AsyncApiClient, task_id: str, tqdm_progress: bool = False, exc_types: list[Type] | None = None) None#

Methods

__init__(client, task_id[, tqdm_progress, ...])

cancel()

Cancel the task.

get_progress()

Get the current progress status of the task.

get_result()

Get the result of the completed task.

is_ready()

Check if the task has completed and the result is ready.

raise_for_status(response)

wait_ready([timeout, check_interval])

Wait for the task to be ready.

wait_result([timeout, check_interval])

Wait for the task to complete and return its result.

Attributes

task_id

The unique identifier for this task.

__init__(client: AsyncApiClient, task_id: str, tqdm_progress: bool = False, exc_types: list[Type] | None = None) None#
raise_for_status(response: Response) None#
property task_id: str#

The unique identifier for this task.

Returns#

str

The unique identifier for this task.

async get_progress() TaskProgress#

Get the current progress status of the task.

Returns#

TaskProgress

The current progress status, containing information about completion percentage and status message.

async is_ready() bool#

Check if the task has completed and the result is ready.

Returns#

bool

True if the task is complete and result can be retrieved, False otherwise.

async wait_result(timeout: float = -1.0, check_interval: float = 1.0) T#

Wait for the task to complete and return its result.

Parameters#

timeoutfloat, default=-1.0

Maximum time in seconds to wait for completion. A negative value means wait indefinitely.

check_intervalfloat, default=0.5

Time in seconds between status checks.

Returns#

T

The result of the task.

Raises#

TaskError

If the task failed or timed out.

async wait_ready(timeout: float = -1.0, check_interval: float = 1.0) None#

Wait for the task to be ready.

Parameters#

timeoutfloat, default=-1.0

Maximum time in seconds to wait for completion. A negative value means wait indefinitely.

check_intervalfloat, default=1.0

Time in seconds between status checks.

Raises#

TaskError

If the task failed or timed out.

async cancel() None#

Cancel the task.