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 – Where to log messages.

  • config_options – Configuration options.

Methods

add_default_config

Add a new default config to the config file, and create the file if it doesn't exist.

get_config_file_path

Get the path to the configuration file.

get_config_item

Get a configuration item.

get_invoc_data

Get the invocation data for the given configuration.

get_invocation

Get the invocation for the given configuration.

is_item_set

Determine if a configuration item is set.

rename_config_key

Change the config key of the loaded config.

save

Write the (modified) configuration to the configuration file.

select_invocation

Select a matching configuration for this invocation using run-time info.

update_invocation

Modify the invocation parameters of the loaded config.

Attributes

logger

Where to log messages.

directory

The directory containing the configuration file.

path

The path to the config file.

contents

The cached contents of the config file.

data

The parsed contents of the config file.

data_rt

The parsed contents of the config file where the alternate parser was used.

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.

Return type:

str

contents#

The cached contents of the config file.

data#

The parsed contents of the config file.

data_rt#

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).

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.

get_invocation(config_key)#

Get the invocation for the given configuration.

Parameters:

config_key (str) – The name of the configuration within the configuration file.

is_item_set(config_key, name)#

Determine if a configuration item is set.

Parameters:
  • config_key (str) – The name of the configuration within the configuration file.

  • name (str) – The name of the configuration item.

logger#

Where to log messages.

path#

The path to the config file.

rename_config_key(config_key, new_config_key)#

Change the config key of the loaded config.

Parameters:
  • config_key (str) – The old name of the configuration within the configuration file.

  • new_config_key (str) – The new name of the configuration.

save()#

Write the (modified) configuration to the configuration file.

static select_invocation(configs, run_time_info, path, config_key=None)#

Select a matching configuration for this invocation using run-time info.

Parameters:
  • configs (Dict) –

  • run_time_info (Dict) –

  • path (Path) –

  • config_key (str | None) –

Return type:

str

update_invocation(config_key, environment_setup=None, match=None)#

Modify the invocation parameters of the loaded config.

Parameters:
  • config_key (str) – The name of the configuration within the configuration file.

  • environment_setup (str | None) – The new value of the environment_setup key.

  • match (Dict | None) – The new values to merge into the match key.