simplebench.tasks moduleπ
module for managing progress tasks using Rich Progress.
- class simplebench.tasks.ProgressTracker(
- *,
- session: Session | None = None,
- task_name: str,
- progress_max: int | float = 100,
- description: str = 'Benchmarking',
- color: Color = Color.GREEN,
Bases:
objectHelper to manage benchmark progress updates.
- property is_running: boolπ
Check if the Rich Progress display is currently running.
- Returns:
True if the display is running, False otherwise.
- Return type:
- class simplebench.tasks.RichProgressTasks( )[source]π
Bases:
objectTask Rich Progress management for benchmarking.
- add_task( ) RichTask[source]π
Add a new task to the Rich Progress display.
If a task with the same name already exists, a
SimpleBenchValueErroris raised.- Parameters:
- Raises:
SimpleBenchValueError β If a task with the same name already exists.
- Returns:
The newly created RichTask instance.
- Return type:
- clear() None[source]π
Clear all tasks from the internal task management.
This causes all tasks to be terminated and removed from the managed index.
- property is_running: boolπ
If the Rich Progress display is currently running.
The display is considered running if the start() method has been called and the stop() method has not yet been called.
Value is True if running, False otherwise.
- new_task( ) RichTask[source]π
Create a new RichTask.
The new task is initialized with the given parameters, added to the task manager index, and a
RichTaskinstance returned.The
RichTaskinstance provides control over the taskβs progress and status.
- property progress: Progressπ
Get the Rich Progress instance.
- class simplebench.tasks.RichTask(
- progress: Progress,
- name: str,
- description: str,
- completed: int = 0,
- total: float = 100.0,
- verbosity: Verbosity = Verbosity.NORMAL,
Bases:
objectRepresents and controls a Rich Progress task.
- get_task() Task | None[source]π
Get the Rich Task instance from the Progress instance.
- Returns:
The Rich Task instance, or None if not found.
- Return type:
Task or None
- update( ) None[source]π
Update the task progress.
If an attempt to update a terminated task is made, a
SimpleBenchRuntimeErrorwill be raised.- Parameters:
- Raises:
SimpleBenchTypeError β If any argument is of an incorrect type.
SimpleBenchRuntimeError β If the task has already been terminated.