Parsing of experiment configuration

orion.core.resolve_config – Configuration parsing and resolving

How:

  • Experiment name resolves like this:
    • cmd-arg > cmd-provided orion_config > REQUIRED (no default is given)
  • Database options resolve with the following precedence (high to low):
    • cmd-provided orion_config > env vars > default files > defaults

See also

ENV_VARS, ENV_VARS_DB

  • All other managerial, Optimization or Dynamic options resolve like this:

    • cmd-args > cmd-provided orion_config > database (if experiment name can be found) > default files

Default files are given as a list at orion.core.DEF_CONFIG_FILES_PATHS and a precedence is respected when building the settings dictionary:

  • default orion example file < system-wide config < user-wide config

Note

Optimization entries are required, Dynamic entry is optional.

orion.core.io.resolve_config.fetch_config(args)[source]

Return the config inside the .yaml file if present.

orion.core.io.resolve_config.fetch_default_options()[source]

Create a dict with options from the default configuration files.

Respect precedence from application’s default, to system’s and user’s.

See also

orion.core.DEF_CONFIG_FILES_PATHS

orion.core.io.resolve_config.fetch_env_vars()[source]

Fetch environmental variables related to orion’s managerial data.

orion.core.io.resolve_config.fetch_metadata(cmdargs)[source]

Infer rest information about the process + versioning

orion.core.io.resolve_config.fetch_user_repo(user_script)[source]

Fetch the GIT repo and its root path given user’s script.

orion.core.io.resolve_config.infer_versioning_metadata(user_script)[source]

Infer information about user’s script versioning if available. Fills the following information in VCS:

is_dirty shows whether the git repo is at a clean state. HEAD_sha gives the hash of head of the repo. active_branch shows the active branch of the repo. diff_sha shows the hash of the diff in the repo.

Returns:the VCS but filled with above info.
orion.core.io.resolve_config.is_exe(path)[source]

Test whether path describes an executable file.

orion.core.io.resolve_config.merge_configs(*configs)[source]

Merge configuration dictionnaries following the given hierarchy

Suppose function is called as merge_configs(A, B, C). Then any pair (key, value) in C would overwrite any previous value from A or B. Same apply for B over A.

If for some pair (key, value), the value is a dictionary, then it will either overwrite previous value if it was not also a directory, or it will be merged following merge_configs(old_value, new_value).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
a = {'a': 1, 'b': {'c': 2}}
b = {'b': {'c': 3}}
c = {'b': {'c': {'d': 4}}}

m = resolve_config.merge_configs(a, b, c)

assert m == {'a': 1, 'b': {'c': {'d': 4}}}

a = {'a': 1, 'b': {'c': 2, 'd': 3}}
b = {'b': {'c': 4}}
c = {'b': {'c': {'e': 5}}}

m = resolve_config.merge_configs(a, b, c)

assert m == {'a': 1, 'b': {'c': {'e': 5}, 'd': 3}}