qlauncher.launcher.aql.aql_task#
Summary#
Classes:
Async-like task that is executed by a BaseJobManager. |
Functions:
Compute remaining time budget when multiple waits share a single overall timeout. |
Reference#
- qlauncher.launcher.aql.aql_task.get_timeout(max_timeout: int | float | None, start: int | float) float | None[source]#
Compute remaining time budget when multiple waits share a single overall timeout.
- Parameters:
max_timeout (int | float | None) – Total allowed timeout in seconds. If None, wait indefinitely.
start (int | float) – Start timestamp from time.time().
- Returns:
Remaining timeout in seconds, or None if max_timeout was None.
- Return type:
float | None
- class qlauncher.launcher.aql.aql_task.ManagerBackedTask(task: Callable, dependencies: list[ManagerBackedTask] | None = None, callbacks: list[Callable] | None = None, pipe_dependencies: bool = False)[source]#
Bases:
objectAsync-like task that is executed by a BaseJobManager. Returned to users. Supports dependencies, callbacks, cancellation, and result() waiting.
- is_ready() bool[source]#
Check whether the task can be submitted.
- Parameters:
None.
- Returns:
True if all dependency tasks are terminal (DONE/FAILED/CANCELLED), otherwise False.
- Return type:
bool
- cancel() bool[source]#
Attempt to cancel the task.
If the task has already been submitted, this forwards the cancellation to the manager best-effort (manager.cancel(job_id)). The task is marked CANCELLED and becomes terminal.
- Parameters:
None.
- Returns:
True if the task is now cancelled (or was already cancelled). False if the task was already terminal (DONE/FAILED) and cannot be cancelled.
- Return type:
bool
- result(timeout: float | int | None = None) Result | None[source]#
Wait for the task to reach a terminal state and return its outcome.
- Parameters:
timeout (float | int | None) – Maximum time to wait in seconds. If None, wait indefinitely.
- Returns:
The task result if completed successfully. None if the task was cancelled.
- Raises:
TimeoutError – If timeout expires before the task becomes terminal (task is cancelled).
BaseException – Re-raises the exception produced by the job when the task is FAILED.
- Return type:
Result | None