Configuration how-tos#
Get and set config items#
Using the config sub-command in the hpcFlow CLI, we can get configuration items like this:
hpcflow config get machine
Items can be set like this:
hpcflow config set machine my-machine-name
In the Python API, we can interact with the hpcFlow configuration as below. Note that we must call config.save
to make the config changes persistent, otherwise any changes made will only be temporary.
import hpcflow.app as hf
# print the value of the `machine` item:
print(hf.config.machine)
# set the value of the `machine` item:
hf.config.machine = "my-machine-name"
# optionally save the changes to the config file:
hf.config.save()
If you want to change a configuration item temporarily (just for the current session), you can also provide configuration item values to load_config and reload_config, like this:
import hpcflow.app as hf
# modify the log console level just for this session:
hf.load_config(log_console_level="debug")
See the configuration reference documentation for a listing of configurable items.
Reset the config to default values#
Usually, when hpcFlow is invoked, the first thing it does is load the configuration file. However, if you have updated to a newer, incompatible version, sometime your existing configuration file will fail validation. In this case, you can reset the configuration file to its default value by running the following CLI command:
hpcflow manage reset-config
Within the Python API, the config can be reset like this:
import hpcflow.app as hf
hf.reset_config()
Warning
Resetting the configuration will remove any custom configuration you had, including pointers to template component source files (like environment source files). If you want to make a copy of the old file before resetting, you can retrieve its file path like this: hpcflow manage get-config-path
, with the CLI, or, hf.get_config_path()
, with the Python API.
Clear the known-submissions file#
The known-submissions file is used to track running and recent workflow, and is used by the hf.show
/ hpcflow show
command. Sometimes you might need to clear this file, which can be done like this:
hpcflow manage clear-known-subs
Within the Python API, the equivalent command is:
import hpcflow.app as hf
hf.clear_known_submissions_file()