ThreadPoolTaskHandler Objects

class ThreadPoolTaskHandler()
A task handler that manages dependencies and executes tasks in a thread pool.

submit_task

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

get_children

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

increment_retry

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

get_status

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

get_result

def get_result(task_id: str)
Get result if task completed, otherwise raises exception

get_retry_count

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

all_tasks_completed

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