armi.settings.caseSettings module

This defines a Settings object that acts mostly like a dictionary. It is meant to be treated mostly like a singleton, where each custom ARMI object has access to it. It contains global 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 XML file. The ARMI GUI is designed to create this settings file, which is then loaded by an ARMI process on the cluster.

A master case settings is created as masterCs

class armi.settings.caseSettings.Settings(fName=None)[source]

Bases: object

A container for global settings, such as case title, power level, and many run options.

It is accessible to most ARMI objects through self.cs (for ‘Case Settings’). It acts largely as a dictionary, and setting values are accessed by keys.

The settings object has a 1-to-1 correspondence with the ARMI settings input file. This file may be created by hand or by the GUI in submitter.py.

Instantiate a settings object

Parameters

fName (str, optional) – Path to a valid yaml settings file that will be loaded

instance = None
defaultCaseTitle = 'armi'
property inputDirectory
property caseTitle
property environmentSettings
__setstate__(state)[source]

Rebuild schema upon unpickling since schema is unpickleable.

Pickling happens during mpi broadcasts and also during testing where the test reactor is cached.

keys()[source]
update(values)[source]
clear()[source]
duplicate()[source]
revertToDefaults()[source]

Sets every setting back to its default 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 file.

Supports YAML and two XML formats, the newer (tags are the key, etc.) and the former (tags are the type, etc.). If the extension is xml, it assumes XML format. Otherwise, YAML is assumed.

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.

loadFromString(string, handleInvalids=True)[source]

Read in settings from a string.

Supports two xml formats, the newer (tags are the key, etc.) and the former (tags are the type, etc.)

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.

loadAllDefaults()[source]

Initializes all setting objects from the default files

Crawls the res folder for all XML files, tries to load them as settings files and sets all default settings from there. (if there is a duplicate setting it will throw an error)

Also grabs explicitly-defined Settings objects for framework settings.

The formatting of the file name is important as it clues it in to what’s valid.

writeToXMLFile(fName, style='short')[source]

Write out settings to an xml file

Parameters
  • fName (str) – the file to write to

  • style (str) – the method of XML output to be used when creating the xml file for the current state of settings

writeToYamlFile(fName, style='short')[source]

Write settings to a yaml file.

Notes

This resets the current CS’s path to the newly written path.

Parameters
  • fName (str) – the file to write to

  • style (str) – the method of output to be used when creating the file for the current state of settings

writeToYamlStream(stream, style='short')[source]

Write settings in yaml format to an arbitrary stream.

setSettingsReport()[source]

Puts settings into the report manager

updateEnvironmentSettingsFrom(otherCs)[source]

Updates the environment settings in this object based on some other cs (from the GUI, most likely)

Parameters

otherCs (Settings object) – A cs object that environment settings will be inherited from.

This enables users to run tests with their environment rather than the reference environment

temporarilySet(settingName, temporaryValue)[source]

Change a setting that you will restore later.

Useful to change settings before doing a certain run and then reverting them

See also

unsetTemporarySettings()

reverts this

unsetTemporarySettings()[source]