hpcflow.sdk.config.config_file.ConfigFile#
- class hpcflow.sdk.config.config_file.ConfigFile(directory, logger, config_options)#
Bases:
object
Configuration file.
- Parameters:
directory – The directory containing the configuration file.
logger (logging.Logger) – Where to log messages.
config_options (ConfigOptions) – Configuration options.
Methods
Add a new default config to the config file, and create the file if it doesn't exist.
Get the path to the configuration file.
Get a configuration item.
Get the invocation data for the given configuration.
Get the invocation for the given configuration.
Determine if a configuration item is set.
Change the config key of the loaded config.
Write the (modified) configuration to the configuration file.
Select a matching configuration for this invocation using run-time info.
Modify the invocation parameters of the loaded config.
Attributes
The cached contents of the config file.
The parsed contents of the config file.
The parsed contents of the config file where the alternate parser was used.
The path to the config file.
Where to log messages.
The directory containing the configuration file.
- add_default_config(config_options, name=None)#
Add a new default config to the config file, and create the file if it doesn’t exist.
- Parameters:
config_options (ConfigOptions) –
name (str | None) –
- Return type:
- property data: ConfigDict#
The parsed contents of the config file.
- property data_rt: ConfigDict#
The parsed contents of the config file where the alternate parser was used.
- directory#
The directory containing the configuration file.
- static get_config_file_path(directory)#
Get the path to the configuration file.
- get_config_item(config_key, name, *, raise_on_missing=False, default_value=None)#
Get a configuration item.
- Parameters:
config_key (str) – The name of the configuration within the configuration file.
name (str) – The name of the configuration item.
raise_on_missing (bool) – Whether to raise an error if the config item is absent.
default_value – The default value to use when the config item is absent (and
raise_on_missing
is not specified).
- Return type:
Any | None
- get_invoc_data(config_key)#
Get the invocation data for the given configuration.
- Parameters:
config_key (str) – The name of the configuration within the configuration file.
- Return type:
- get_invocation(config_key)#
Get the invocation for the given configuration.
- Parameters:
config_key (str) – The name of the configuration within the configuration file.
- Return type:
- is_item_set(config_key, name)#
Determine if a configuration item is set.
- logger#
Where to log messages.
- rename_config_key(config_key, new_config_key)#
Change the config key of the loaded config.
- save()#
Write the (modified) configuration to the configuration file.
- Return type:
None
- static select_invocation(configs, run_time_info, path, config_key=None)#
Select a matching configuration for this invocation using run-time info.
- update_invocation(config_key, environment_setup=None, match=None)#
Modify the invocation parameters of the loaded config.