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.

Functions

main(→ None)

Create CLI.

Module Contents

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

Default config setup using YAML.

_dict_config = None[source]
_merge_dicts(base: Dict, override: Dict) Dict[source]

Utility function to merge two dictionaries.

_get_env_var_name(section: str, key: str) str[source]
_get_environment_variable(section: str, key: str) str | None[source]
_interpolate_env_vars(value: Any) Any[source]
_coerce_value(value: Any) Any[source]

Recursively coerce values to appropriate Python types.

  • ‘true’, ‘false’, etc. → bool

  • Numeric strings → int/float

  • JSON / Python literals → parsed objects

  • Dict / list containers → recurse element-wise

  • Anything else → returned unchanged

_get_yaml_variable(section: str, key: str) str | None[source]
_get_dict_config_variable(section: str, key: str) str | None[source]
_wrapped_get(section: str, key: str) str[source]
get(section: str, key: str) str[source]

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][source]

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][source]

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[source]

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

Raise if key not found.

get_int(section: str, key: str) int[source]

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

Raise if key not found.

get_float(section: str, key: str) float[source]

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

set(section: str, key: str, val: str) None[source]

Set the configuration value for the section/key.

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

Persist the current config to disk.

class core.configuration.ConfigCLI[source]

Bases: jobmon.core.cli.CLI

CLI for `jobmon_config.

_subparsers[source]
core.configuration.main(argstr: str | None = None) None[source]

Create CLI.