Skip to main content

ThreadPoolTaskHandler

A task handler that manages dependencies and executes tasks in a thread pool.

all_tasks_completed

def all_tasks_completed(self) -> bool
Check if all tasks are completed. Returns
  • bool: True if all tasks are completed, False otherwise.

get_children

def get_children(self, parent_task_id: str) -> list[dict]
Get the children of a task.

get_result

def get_result(self, task_id: str) -> Any
Get result if task completed, otherwise raises exception.

get_retry_count

def get_retry_count(self, task_id: str) -> int
Get the retry count for a task.

get_status

def get_status(self, task_id: str) -> TaskStatus
Returns the status of a task. Arguments
  • task_id (str): The ID of the task.
Returns
  • TaskStatus: The status of the task.

increment_retry

def increment_retry(self, task_id: str) -> None
Increment the retry count for a task. Arguments
  • task_id (str): The ID of the task.

submit_task

def submit_task(self,
                task_id: str,
                async_fn: Union[Callable[[], Awaitable[Any]], Coroutine],
                dependent_on_prev: bool=False) -> None
Submit a task to the thread pool. Arguments
  • task_id (str): The ID of the task.
  • async_fn (Union[Callable[[], Awaitable[Any]], Coroutine]): The async function to submit to the thread pool.
  • dependent_on_prev (bool): Whether the task depends on the previous task.