commonpower.benchmark.benchmark.Benchmark

class Benchmark(name: str, system_node: System, storage: BenchmarkStorage, deployment_runner: BaseRunner, trainer: BaseTrainer | None = None, n_steps: int = 24, fixed_start: datetime | None = None, global_seed: int | None = None)[source]

Bases: object

Benchmark class for creating reusable benchmark scenarios.

Parameters:
  • name (str) – The name of the benchmark scenario.

  • system_node (System) – The system node object representing the system configuration.

  • storage (BenchmarkStorage) – The storage object used to store the benchmark scenario.

  • deployment_runner (BaseRunner) – The deployment runner object used to run the scenario.

  • trainer (Optional[BaseTrainer]) – The trainer object used for training (optional).

  • n_steps (int) – The number of steps to run the benchmark scenario (default: 24).

  • fixed_start (datetime) – The fixed start time for the scenario (default: None).

  • global_seed (Optional[int]) – The global seed for random number generation (optional).

store(storage_path

Path): Write the benchmark scenario to storage.

load(path

Path, storage: BenchmarkStorage) -> Benchmark: Load an existing benchmark scenario from storage.

run()[source]

Run the benchmark scenario with the predefined configuration.

Methods

load

Load an existing benchmark scenario from storage.

run

Run the benchmark scenario with the predefined configuration.

store

Write the benchmark scenario to storage using the previously specified storage provider.

classmethod load(uri: Path, storage: BenchmarkStorage) Benchmark[source]

Load an existing benchmark scenario from storage. This creates a new instance of the Benchmark class which can be used to run the scenario.

Parameters:
  • uri (Path) – The uri to the stored benchmark scenario. This depends on the storage type. For file storage, this is the file path. For MongoDB storage, this is the hash of the benchmark scenario.

  • storage (BenchmarkStorage) – The storage object used to load the benchmark scenario.

Returns:

Benchmark – The loaded benchmark scenario.

run() None[source]

Run the benchmark scenario with the predefined configuration.

store(storage_path: Path) None[source]

Write the benchmark scenario to storage using the previously specified storage provider.

Parameters:

storage_path (Path) – The path to the storage location. This depends on the storage type. For file storage, this is the file path. For MongoDB storage, this is not required.

Raises:

ValueError – If the scenario was modified after creation.