saveVerbositySettings

saveVerbositySettings(filename)

Save the verbosity settings for the current session to a file.

Parameters:

filename (str) – File where to save the verbosity settings to. If the file exists it will be overwritten.

Usage Examples

Create a custom dictionary of verbosity settings, apply them to the current QuantumATK Python session, and save the settings in a JSON file:

# Set custom verbosity settings.
verbosity = {
    'TIME_STAMP': False,
    'MATRIX_SIZES': False,
    'CHECKPOINT_FILE': False,
}
setVerbosity(verbosity)

# Save the verbosity settings in a JSON file.
# Note that this file must be named 'verbosity.json'.
saveVerbositySettings('verbosity.json')

Important

The saved file must be named verbosity.json. Otherwise, QuantumATK will not recognize it as a file containing verbosity settings. See also the Notes section below.

You can also save the pre-defined MinimalLog verbosity settings:

# Set the MinimalLog verbosity settings.
setVerbosity(MinimalLog)

# Save the MinimalLog verbosity settings in a JSON file.
# Note that this file must be named 'verbosity.json'.
saveVerbositySettings('verbosity.json')

See the section below to learn how to apply the saved verbosity settings to QuantumATK jobs.

Notes

Most parts of the QuantumATK logging output is associated with a “logging region”, see showVerbosityRegions(). The default QuantumATK verbosity mode is True for all logging regions, i.e., to print out all available logging output. However, the verbosity can be manually changed, such that the logging output becomes more condensed, see setVerbosity().

Whenever running QuantumATK Python, the logging verbosity is set in the following manner:

  1. The default verbosity mode is “print everything”; all logging regions are initially verbose.

  2. Next, if the file $HOME/.quantumatk/verbosity.json exists, QuantumATK will automatically attempt to load verbosity settings from it.

  3. Next, if a file verbosity.json exists in the current working directory (the directory from which QuantumATK Python is launched), the verbosity settings in that file are automatically loaded. Any verbosity settings already loaded in step 2 will be overridden.

  4. Finally, if the setVerbosity() function is used in the executed QuantumATK Python script or interactive session, those verbosity settings are the last ones to be applied. Any verbosity settings already loaded in step 2 or 3 will be overridden.

Note

Steps 2 and 3 in the list above require no user action, except for placing a suitable verbosity.json file in one or more directories. No need for using the setVerbosity() function in QuantumATK Python scripts, except for additional tweaking of the verbosity settings.

In both cases, use the saveVerbositySettings() function to create the verbosity.json file.

Tip

Step 2 should be used to automatically apply custom global verbosity settings, while step 3 is used for automatically applying custom local verbosity settings.