hpcflow.sdk.config.config.Config#

class hpcflow.sdk.config.config.Config(app, config_file, options, logger, config_key, uid=None, callbacks=None, variables=None, **overrides)#

Bases: object

Application configuration as defined in one or more config files.

Notes

On modifying/setting existing values, modifications are not automatically copied to the configuration file; use save() to save to the file. Items in overrides are not saved into the file.

schedulers is used for specifying the available schedulers on this machine, and the default arguments that should be used when initialising the Scheduler object.

shells is used for specifying the default arguments that should be used when initialising the Shell object.

Methods

add_scheduler

add_shell

add_shell_WSL

append

Append a value to a list-like configuration item.

get

get_all

Get all configurable items.

get_configurable

Get a list of all configurable keys.

import_from_file

Import config items from a (remote or local) YAML file.

init

Configure from a known importable config.

pop

Remove a value from a specified index of a list-like configuration item.

prepend

Prepend a value to a list-like configuration item.

register_config_get_callback

Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on get of the item.

register_config_set_callback

Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on set of the item.

reset

Reset to the default configuration.

save

Save any modified/unset configuration items into the file.

set

Set the value of a configuration item.

set_github_demo_data_dir

Set the demo_data_dir item, to an fsspec Github URL.

unset

Unset the value of a configuration item.

update

Update a map-like configuration item.

Parameters:
add_scheduler(scheduler, **defaults)#
add_shell(shell, **defaults)#
add_shell_WSL(**defaults)#
append(path, value, is_json=False)#

Append a value to a list-like configuration item.

get(path, callback=True, copy=False, ret_root=False, ret_parts=False, default=None)#
get_all(include_overrides=True, as_str=False)#

Get all configurable items.

get_configurable()#

Get a list of all configurable keys.

import_from_file(file_path, rename=True, make_new=False)#

Import config items from a (remote or local) YAML file. Existing config items of the same names will be overwritten.

Parameters:
  • file_path – Local or remote path to a config import YAML file which may have top-level keys “invocation” and “config”.

  • rename – If True, the current config will be renamed to the stem of the file specified in file_path. Ignored if make_new is True.

  • make_new – If True, add the config items as a new config, rather than modifying the current config. The name of the new config will be the stem of the file specified in file_path.

init(known_name, path=None)#

Configure from a known importable config.

Parameters:
  • known_name (str) –

  • path (str | None) –

pop(path, index)#

Remove a value from a specified index of a list-like configuration item.

prepend(path, value, is_json=False)#

Prepend a value to a list-like configuration item.

register_config_get_callback(name)#

Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on get of the item.

register_config_set_callback(name)#

Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on set of the item.

reset()#

Reset to the default configuration.

save()#

Save any modified/unset configuration items into the file.

set(path, value, is_json=False, quiet=False)#

Set the value of a configuration item.

Parameters:

path (str) –

set_github_demo_data_dir(sha)#

Set the demo_data_dir item, to an fsspec Github URL.

We use this (via the CLI) when testing the frozen app on Github, because, by default, the SHA is set to the current version tag, which might not include recent changes to the demo data.

unset(name)#

Unset the value of a configuration item.

update(path, value, is_json=False)#

Update a map-like configuration item.

Parameters:

path (str) – A dot-delimited string of the nested path to update.