energytrackr.config packageΒΆ

SubmodulesΒΆ

energytrackr.config.config_model moduleΒΆ

This module defines the configuration model for the pipeline.

class energytrackr.config.config_model.ExecutionPlanDefinition(*, mode: ~energytrackr.config.config_model.ModeEnum = ModeEnum.TESTS, compile_commands: list[str] | None = None, granularity: ~energytrackr.config.config_model.GranularityEnum = GranularityEnum.COMMITS, pre_command: str | None = None, pre_command_condition_files: set[str] = <factory>, test_command: str, test_command_path: str = '', ignore_failures: bool = True, post_command: str | None = None, num_commits: int | None = None, num_runs: int = 1, num_repeats: int = 1, batch_size: int = 100, randomize_tasks: bool = False, oldest_commit: str | None = None, newest_commit: str | None = None, execute_common_tests: bool = False)[source]ΒΆ

Bases: BaseModel

Execution plan for the pipeline.

batch_size: intΒΆ
check_compile_commands_for_benchmarks() Self[source]ΒΆ

Ensure that compile_commands is provided when benchmarks mode is selected.

Returns:

The instance of the class.

Return type:

Self

Raises:

ValueError – If compile_commands is not provided in benchmarks mode.

compile_commands: list[str] | NoneΒΆ
execute_common_tests: boolΒΆ
granularity: GranularityEnumΒΆ
ignore_failures: boolΒΆ
mode: ModeEnumΒΆ
model_config: ClassVar[ConfigDict] = {}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

newest_commit: str | NoneΒΆ
num_commits: int | NoneΒΆ
num_repeats: intΒΆ
num_runs: intΒΆ
oldest_commit: str | NoneΒΆ
post_command: str | NoneΒΆ
pre_command: str | NoneΒΆ
pre_command_condition_files: set[str]ΒΆ
randomize_tasks: boolΒΆ
test_command: strΒΆ
test_command_path: strΒΆ
class energytrackr.config.config_model.GranularityEnum(*values)[source]ΒΆ

Bases: StrEnum

Granularity of execution for the pipeline.

  • β€˜commits’: Run tests for each commit.

  • β€˜branches’: Run tests for each branch.

  • β€˜tags’: Run tests for each tag.

BRANCHES = 'branches'ΒΆ
COMMITS = 'commits'ΒΆ
TAGS = 'tags'ΒΆ
class energytrackr.config.config_model.LimitsDefinition(*, temperature_safe_limit: int)[source]ΒΆ

Bases: BaseModel

Limits for the pipeline execution.

model_config: ClassVar[ConfigDict] = {}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

temperature_safe_limit: intΒΆ
class energytrackr.config.config_model.ModeEnum(*values)[source]ΒΆ

Bases: StrEnum

Mode of execution for the pipeline.

  • β€˜tests’: Run tests only.

  • β€˜benchmarks’: Run benchmarks only.

BENCHMARKS = 'benchmarks'ΒΆ
TESTS = 'tests'ΒΆ
class energytrackr.config.config_model.PipelineConfig(*, config_version: str = '1.0.0', repo: ~energytrackr.config.config_model.RepositoryDefinition, execution_plan: ~energytrackr.config.config_model.ExecutionPlanDefinition, limits: ~energytrackr.config.config_model.LimitsDefinition, tracked_file_extensions: set[str], ignored_directories: set[str] = <factory>, cpu_thermal_file: str, setup_commands: list[str] | None = None, regression_detection: ~energytrackr.config.config_model.RegressionDetectionDefinition = <factory>, timeout: int = 120)[source]ΒΆ

Bases: BaseModel

Configuration model for the entire pipeline.

config_version: strΒΆ
cpu_thermal_file: strΒΆ
execution_plan: ExecutionPlanDefinitionΒΆ
ignored_directories: set[str]ΒΆ
limits: LimitsDefinitionΒΆ
model_config: ClassVar[ConfigDict] = {}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

regression_detection: RegressionDetectionDefinitionΒΆ
repo: RepositoryDefinitionΒΆ
setup_commands: list[str] | NoneΒΆ
timeout: intΒΆ
tracked_file_extensions: set[str]ΒΆ
class energytrackr.config.config_model.RegressionDetectionDefinition(*, min_commits_before: int = 1, min_commits_after: int = 0)[source]ΒΆ

Bases: BaseModel

Configuration for regression detection context in the pipeline.

This model specifies the minimum number of commits to include before and/or after a candidate commit.

min_commits_after: intΒΆ
min_commits_before: intΒΆ
model_config: ClassVar[ConfigDict] = {}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class energytrackr.config.config_model.RepositoryDefinition(*, url: str, branch: str | None = None, clone_options: list[str] | None = None)[source]ΒΆ

Bases: BaseModel

Definition of the repository to be tested.

branch: str | NoneΒΆ
clone_options: list[str] | NoneΒΆ
model_config: ClassVar[ConfigDict] = {}ΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

url: strΒΆ

energytrackr.config.config_store moduleΒΆ

Module to store the pipeline configuration.

class energytrackr.config.config_store.Config[source]ΒΆ

Bases: object

Class to retrieve the unique configuration of the pipeline.

classmethod get_config() PipelineConfig[source]ΒΆ

Gets the pipeline configuration.

Returns:

The pipeline configuration.

Return type:

PipelineConfig

Raises:

ConfigurationSingletonNotSetError – If the configuration has not been set.

classmethod reset() None[source]ΒΆ

Reset the singleton (for testing purposes only).

classmethod set_config(new_config: PipelineConfig) None[source]ΒΆ

Sets the pipeline configuration.

Parameters:

new_config (PipelineConfig) – The new pipeline configuration to set.

Raises:

ConfigurationSingletonAlreadySetError – If the configuration has already been set.

energytrackr.config.loader moduleΒΆ

This module provides a function to load the pipeline configuration from a YAML file.

energytrackr.config.loader.load_pipeline_config(config_path: str) None[source]ΒΆ

Load the pipeline configuration from the specified YAML file and set it as the configuration for the pipeline.

Parameters:

config_path (str) – The path to the YAML configuration file.

Module contentsΒΆ

Configuration module for the project.