hpcflow.sdk.config.config.Config#
- class hpcflow.sdk.config.config.Config(app, options, logger, config_dir, config_invocation_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.
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.
Format the instance in a string, optionally exclude some keys.
Unset the value of a configuration item.
Update a map-like configuration item.
- Parameters:
app (BaseApp) –
options (ConfigOptions) –
logger (logging.Logger) –
config_dir (Optional[PathLike]) –
config_invocation_key (Optional[str]) –
- add_scheduler(scheduler, **kwargs)#
- 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.
- 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.
- to_string(exclude=None, just_meta=False)#
Format the instance in a string, optionally exclude some keys.
- Parameters:
exclude (List | None) – List of keys to exclude. Optional.
just_meta – If True, just return a str of the meta-data. This is useful to show during initialisation, in the case where the configuration is otherwise invalid.
- unset(name)#
Unset the value of a configuration item.