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

add_scheduler

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.

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.

to_string

Format the instance in a string, optionally exclude some keys.

unset

Unset the value of a configuration item.

update

Update a map-like configuration item.

Parameters:
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.

set(path, value, is_json=False)#

Set the value of a configuration item.

Parameters:

path (str) –

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.

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.