qlauncher.launcher.aql.aql_task#

Wrapper for QLauncher that enables the user to launch tasks asynchronously (futures + multiprocessing)

Summary#

Classes:

AQLTask

Task object returned to user, so that dependencies can be created.

Functions:

get_timeout

Get timeout to wait on an event, useful when awaiting multiple tasks and total timeout must be max_timeout.

Reference#

qlauncher.launcher.aql.aql_task.get_timeout(max_timeout: int | float | None, start: int | float) float | None[source]#

Get timeout to wait on an event, useful when awaiting multiple tasks and total timeout must be max_timeout.

Parameters:
  • max_timeout (int | float | None) – Total allowed timeout, None = infinite wait.

  • start (int | float) – Await start timestamp (time.time())

Returns:

Remaining timeout or None if max_timeout was None

Return type:

int | float | None

class qlauncher.launcher.aql.aql_task.AQLTask(task: Callable, dependencies: list[AQLTask] | None = None, callbacks: list[Callable] | None = None, pipe_dependencies: bool = False)[source]#

Bases: object

Task object returned to user, so that dependencies can be created.

task#

function that gets executed asynchronously

Type:

Callable

dependencies#

Optional dependencies. The task will wait for all its dependencies to finish, before starting.

Type:

list[AQLTask]

callbacks#

Callbacks ran when the task finishes executing. Task result is inserted as an argument to the function.

Type:

list[Callable]

pipe_dependencies#

If True results of tasks defined as dependencies will be passed as arguments to self.task. Defaults to False.

Type:

bool