armi.settings.caseSettings module
This defines a Settings object that acts mostly like a dictionary. It is meant so that each ARMI run has one-and-only-one Settings object. It records user settings like the core power level, the input file names, the number of cycles to run, the run type, the environment setup, and hundreds of other things.
A Settings object can be saved as or loaded from an YAML file. The ARMI GUI is designed to create this settings file, which is then loaded by an ARMI process on the cluster.
- class armi.settings.caseSettings.Settings(fName=None)[source]
Bases:
object
A container for run settings, such as case title, power level, and many more.
Notes
The actual settings in any instance of this class are immutable.
Instantiate a Settings object.
- Parameters:
fName (str, optional) – Path to a valid yaml settings file that will be loaded
- defaultCaseTitle = 'armi'
- property inputDirectory
Getter for settings file path.
- property caseTitle
Getter for settings case title.
- property environmentSettings
Getter for environment settings.
- getSetting(key, default=None)[source]
Return a copy of an actual Setting object, instead of just its value.
Notes
This is used very rarely, try to organize your code to only need a Setting value.
- failOnLoad()[source]
This method is used to force loading a file to fail.
After command line processing of settings has begun, the settings should be fully defined. If the settings are loaded
- loadFromInputFile(fName, handleInvalids=True, setPath=True)[source]
Read in settings from an input YAML file.
Passes the reader back out in case you want to know something about how the reading went like for knowing if a file contained deprecated settings, etc.
- registerUserPlugins()[source]
Add any ad-hoc ‘user’ plugins that are referenced in the settings file.
- loadFromString(string, handleInvalids=True)[source]
Read in settings from a YAML string.
Passes the reader back out in case you want to know something about how the reading went like for knowing if a file contained deprecated settings, etc.
- initLogVerbosity()[source]
Central location to init logging verbosity.
Notes
This means that creating a Settings object sets the global logging level of the entire code base.
- writeToYamlFile(fName, style='short', fromFile=None)[source]
Write settings to a yaml file.
Notes
This resets the current CS’s path to the newly written absolute path.
- Parameters:
fName (str) – the file to write to
style (str (optional)) – the method of output to be used when creating the file for the current state of settings (short, medium, or full)
fromFile (str (optional)) – if the source file and destination file are different (i.e. for cloning) and the style argument is
medium
, then this arg is used
- getSettingsSetByUser(fPath)[source]
Grabs the list of settings in the user-defined input file so that the settings can be tracked outside of a Settings object.
- writeToYamlStream(stream, style='short', settingsSetByUser=[])[source]
Write settings in yaml format to an arbitrary stream.
- updateEnvironmentSettingsFrom(otherCs)[source]
Updates the environment settings in this object based on some other cs (from the GUI, most likely).
- Parameters:
otherCs (Settings) – A cs object that environment settings will be inherited from.
environment (This enables users to run tests with their environment rather than the reference) –
- modified(caseTitle=None, newSettings=None)[source]
Return a new Settings object containing the provided modifications.
- setModuleVerbosities(force=False)[source]
Attempt to grab the module-level logger verbosities from the settings file, and then set their log levels (verbosities).
- Parameters:
force (bool, optional) – If force is False, don’t overwrite the log verbosities if the logger already exists. IF this needs to be used mid-run, force=False is safer.
Notes
This method is only meant to be called once per run.