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.
Initialize the ProgressTracker.
- Parameters:
session (Session or None) β The Session instance.
task_name (str) β The name of the progress task.
progress_max (int or float, optional) β The maximum value for progress completion. Defaults to 100.
description (str, optional) β The description for the progress task. Defaults to βBenchmarkingβ.
color (Color, optional) β The color for the progress task. Defaults to
GREEN.
- 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.
Initialize a new RichProgressTasks instance.
This instance manages multiple
RichTaskinstances and provides a Rich Progress display for console output.The display will not start until the
start()method is called on this instance.- Parameters:
verbosity (Verbosity) β The verbosity level for console output.
console (Console, optional) β The Rich Console instance for displaying output. If None, a new Console will be created as needed. Defaults to None.
- Raises:
SimpleBenchTypeError β If
verbosityis not aVerbosityenum.
- 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.
- 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.
Construct a new RichTask.
- Parameters:
name (str) β The name of the task.
description (str) β The description of the task.
completed (int, optional) β Completion step. Defaults to 0.
total (int, optional) β Total number of steps. Defaults to 100.
progress (Progress) β The Progress instance to use.
verbosity (Verbosity) β The verbosity level for console output.
- Raises:
SimpleBenchTypeError β If any argument is of an incorrect type.
SimpleBenchValueError β If any argument has an invalid value.
- 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.