mlos_bench.config.schemas.config_schemas

A simple class for describing where to find different json config schemas and validating configs against them.

Used by the Launcher and ConfigPersistenceService to validate configs on load.

Notes

Attributes

CONFIG_SCHEMA_DIR

The local directory where all config schemas shipped as a part of the

SCHEMA_STORE

Static SchemaStore instance used for storing and retrieving schemas for

VALIDATION_ENV_FLAG

The special environment flag to set to skip schema validation when "true".

Classes

ConfigSchema

An enum to help describe schema types and help validate configs against them.

SchemaStore

A simple class for storing schemas and subschemas for the validator to

Module Contents

class mlos_bench.config.schemas.config_schemas.ConfigSchema(*args, **kwds)[source]

Bases: enum.Enum

An enum to help describe schema types and help validate configs against them.

validate(config: dict) None[source]

Validates the given config against this schema.

Parameters:

config (dict) – The config to validate.

Raises:
  • jsonschema.exceptions.ValidationError – On validation failure.

  • jsonschema.exceptions.SchemaError – On schema loading error.

Return type:

None

CLI[source]

Json config schema for mlos_bench CLI configuration.

See also

mlos_bench.config

documentation on the configuration system.

mlos_bench.launcher.Launcher

class is responsible for processing the CLI args.

ENVIRONMENT[source]

Json config schema for environments.

GLOBALS[source]

Json config schema for global variables.

OPTIMIZER[source]

Json config schema for optimizers.

SCHEDULER[source]

Json config schema for schedulers.

SERVICE[source]

Json config schema for services.

STORAGE[source]

Json config schema for storage instances.

TUNABLE_PARAMS[source]

Json config schema for tunables instances.

TUNABLE_VALUES[source]

Json config schema for values of TunableGroups instances.

These can be used to specify the values of the tunables for a given experiment using the OneShotOptimizer for instance.

UNIFIED[source]

Combined global json schema use to validate any mlos_bench config file (e.g., *.mlos.jsonc files).

property schema: dict[source]

Gets the schema object for this type.

Return type:

dict

class mlos_bench.config.schemas.config_schemas.SchemaStore[source]

Bases: Mapping

A simple class for storing schemas and subschemas for the validator to reference.

__getitem__(key: str) dict[source]

Gets the schema object for the given key.

Parameters:

key (str)

Return type:

dict

__iter__() Iterator[source]
Return type:

Iterator

__len__() int[source]
Return type:

int

property registry: referencing.Registry[source]

Returns a Registry object with all the schemas loaded.

Return type:

referencing.Registry

mlos_bench.config.schemas.config_schemas.CONFIG_SCHEMA_DIR[source]

The local directory where all config schemas shipped as a part of the mlos_bench module are stored.

mlos_bench.config.schemas.config_schemas.SCHEMA_STORE[source]

Static SchemaStore instance used for storing and retrieving schemas for config validation.

mlos_bench.config.schemas.config_schemas.VALIDATION_ENV_FLAG = 'MLOS_BENCH_SKIP_SCHEMA_VALIDATION'[source]

The special environment flag to set to skip schema validation when “true”.

Useful for local development when you’re making a lot of changes to the config or adding new classes that aren’t in the main repo yet.