core.configuration

Parse configuration options and set them to be used throughout the Jobmon Architecture.

Attributes

DEFAULTS_FILE_NAME

DEFAULTS_FILE

ENV_VAR_PREFIX

Classes

JobmonConfig

Default config setup using YAML.

ConfigCLI

CLI for jobmon_config command.

Functions

main(→ None)

Create CLI.

Module Contents

core.configuration.DEFAULTS_FILE_NAME = 'defaults.yaml'
core.configuration.DEFAULTS_FILE
core.configuration.ENV_VAR_PREFIX = 'JOBMON__'
class core.configuration.JobmonConfig(filepath: str = '', dict_config: Dict | None = None)

Default config setup using YAML.

Jobmon config class.

Parameters:
  • filepath – where to read defaults from.

  • dict_config – Dictionary of values to override.

Config file priority:

  1. user specified file passed in

  2. environment variable JOBMON__CONFIG_FILE (backdoor for testing)

  3. config file from installer

  4. default config file in core

get(section: str, key: str) str

Get the configuration value for the section and key. Raise if key not found.

Parameters:
  • section – the section of the yaml to search.

  • key – the key within the section to retrieve

Raises: ConfigError

get_section(section: str) Dict[str, Any]

Returns a dictionary of all key-value pairs in the given section.

The order of precedence: dict_config > Environment Variable > YAML File.

get_section_coerced(section: str) Dict[str, Any]

Returns a dictionary with all values coerced to appropriate Python types.

Same as get_section() but automatically converts: - String booleans to bool - Numeric strings to int/float - JSON/Python literals to their parsed values - Nested structures recursively

get_boolean(section: str, key: str) bool

Get the configuration value for the section and key as bool.

Raise if key not found.

get_int(section: str, key: str) int

Get the configuration value for the section and key as int.

Raise if key not found.

get_float(section: str, key: str) float

Get the configuration value for the section/key as float. Raise if key not found.

set(section: str, key: str, val: str) None

Set the configuration value for the section/key.

write(filepath: str | pathlib.Path = '') None

Persist the current config to disk.

class core.configuration.ConfigCLI

Bases: jobmon.core.cli.CLI

CLI for jobmon_config command.

Initialization of client CLI.

core.configuration.main(argstr: str | None = None) None

Create CLI.