fabricatio_digest.models.tasklist
Module for the TaskList class, which represents a sequence of tasks designed to achieve an ultimate target.
This module contains the definition of the TaskList class, which is used to model a series of tasks aimed at achieving a specific ultimate target. It inherits from the ProposedAble interface and provides implementations for task sequence generation.
Classes
A list of tasks designed to achieve an ultimate target. |
Module Contents
- class fabricatio_digest.models.tasklist.TaskList(/, **data: Any)
Bases:
fabricatio_core.models.generic.ProposedAbleA list of tasks designed to achieve an ultimate target.
- tasks: List[fabricatio_core.Task]
The tasks sequence that aims to achieve the ultimate target.
- add_before_exec_hook(hook: Callable[[], Any]) None
Adds a hook to be executed before each task in the task list.
- Parameters:
hook (Callable[[],Any]) – The hook to be added.
- add_after_exec_hook(hook: Callable[[], Any]) None
Adds a hook to be executed after each task in the task list.
- Parameters:
hook (Callable[[],Any]) – The hook to be added.
- inject_context(/, **kwargs) Self
Injects the provided context into all tasks in the task list.
- inject_description(desc: str) Self
Injects the provided description into all tasks in the task list.
- async execute(parallel: bool | None = None) List[Any]
Asynchronously executes the sequence of tasks in the task list.
If the parallel flag is set to True, all tasks are executed concurrently. Otherwise, tasks are executed sequentially. This method provides an awaitable interface for executing all tasks either in parallel using asyncio.gather or sequentially in a loop.
- Parameters:
parallel (Optional[bool]) – Flag indicating whether tasks should be executed in parallel. If None, defaults to the instance’s parallel attribute.
- Returns:
- A list containing the results of each task execution, preserving
the order of tasks as stored in the instance.
- Return type:
List[Any]
- explain() str
Generates an explanation for the task list.
This method uses the task list template to generate an explanation for the task list. The template is loaded from the template manager and the task list is rendered using the task list template.
- Returns:
An explanation for the task list.
- Return type: