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
Append a value to a list-like configuration item.
Get all configurable items.
Get a list of all configurable keys.
Import config items from a (remote or local) YAML file.
Configure from a known importable config.
Remove a value from a specified index of a list-like configuration item.
Prepend a value to a list-like configuration item.
Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on get of the item.
Decorator to register a function as a configuration callback for a specified configuration item name, to be invoked on set of the item.
Reset to the default configuration.
Save any modified/unset configuration items into the file.
Set the value of a configuration item.
Unset the value of a configuration item.
Update a map-like configuration item.
- Parameters:
app (BaseApp) –
config_file (ConfigFile) –
options (ConfigOptions) –
logger (logging.Logger) –
config_key (Optional[str]) –
- 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.
- 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) –
- unset(name)#
Unset the value of a configuration item.