armi.apps module

The base ARMI App class.

This module defines the App class, which is used to configure the ARMI Framework for a specific application. An App implements a simple interface for customizing much of the Framework’s behavior.

Notes

Historical Fun Fact

This pattern is used by many frameworks as a way of encapsulating what would otherwise be global state. The ARMI Framework has historically made heavy use of global state (e.g., armi.nucDirectory.nuclideBases), and it will take quite a bit of effort to refactor the code to access such things through an App object.

class armi.apps.App[source]

Bases: object

The highest-level of abstraction for defining what happens during an ARMI run.

This mostly initializes the default plugin manager. Subclasses are free to adopt this plugin manager and register more plugins of their own, or to throw it away and start from scratch if they do not wish to use the default Framework plugins.

For a description of the things that an ARMI plugin can do, see the armi.plugins module.

name = 'armi'

The program name of the app. This should be the actual name of the python entry point that loads the app, or the name of the module that contains the appropriate __main__ function. For example, if the app is expected to be invoked with python -m myapp, name should be "myapp"

property version: str

Grab the version of this app (defaults to ARMI version).

Notes

This is designed to be over-ridable by Application developers.

property pluginManager: ArmiPluginManager

Return the App’s PluginManager.

getSettings() Dict[str, Setting][source]

Return a dictionary containing all Settings defined by the framework and all plugins.

getParamRenames() Dict[str, str][source]

Return the parameter renames from all registered plugins.

This renders a merged dictionary containing all parameter renames from all of the registered plugins. It also performs simple error checking. The result of this operation is cached, since it is somewhat expensive to perform. If the App detects that its plugin manager’s set of registered plugins has changed, the cache will be invalidated and recomputed.

registerPluginFlags()[source]

Apply flags specified in the passed PluginManager to the Flags class.

registerUserPlugins(pluginPaths)[source]

Register additional plugins passed in by importable paths. These plugins may be provided e.g. by an application during startup based on user input.

Format expected to be a list of full namespaces to plugin classes. There should be a comma between individual plugins and dots representing the file path or importable python namespace.

Examples

importable namespace: armi.stuff.plugindir.pluginMod.pluginCls,armi.whatever.plugMod2.plugCls2

or on Linux/Unix: /path/to/pluginMod.py:pluginCls,/path/to/plugMod2.py:plugCls2

or on Windows: C:\\path\\to\\pluginMod.py:pluginCls,C:\\\\path\\to\\plugMod2.py:plugCls2

Notes

These paths are meant to be taken from a settings file, though this method is public. The idea is that these “user plugins” differ from regular plugins because they are defined during run time, not import time. As such, we restrict their flexibility and power as compared to the usual ArmiPlugins.

property splashText

Return a textual splash screen.

Specific applications will want to customize this, but by default the ARMI one is produced, with extra data on the App name and version, if available.