core.configuration
Parse configuration options and set them to be used throughout the Jobmon Architecture.
Attributes
Classes
Default config setup using YAML. |
|
CLI for |
Functions
|
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:
user specified file passed in
environment variable
JOBMON__CONFIG_FILE(backdoor for testing)config file from installer
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.
- write(filepath: str | pathlib.Path = '') None
Persist the current config to disk.
- class core.configuration.ConfigCLI
Bases:
jobmon.core.cli.CLICLI for
jobmon_configcommand.Initialization of client CLI.