Skip to content

Commit

Permalink
Merging in main
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Dec 29, 2024
2 parents d813695 + bc1ec01 commit 924f8cb
Show file tree
Hide file tree
Showing 242 changed files with 709 additions and 985 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/validatemanifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
Validate that we aren't trying to include files that don't exist.
"""

from glob import glob
import os
from glob import glob

import toml

# CONSTANTS
Expand Down
46 changes: 17 additions & 29 deletions armi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,37 @@
import subprocess
import sys
import traceback
from typing import Optional, List, Type
import warnings
from typing import List, Optional, Type

import __main__ as main

# The _bootstrap module performs operations that may need to occur before it is
# necessarily safe to import the rest of the ARMI system. Things like:
# - configure the MPI environment
# - detect the nature of interaction with the user (terminal UI, GUI, unsupervized, etc)
# - Initialize the nuclide database
import armi._bootstrap
from armi import context
from armi import apps, cli, context, pluginManager, plugins, runLog
from armi.context import (
ROOT,
RES,
DOC,
USER,
START_TIME,
APP_DATA,
CURRENT_MODE,
DOC,
MPI_COMM,
MPI_RANK,
MPI_DISTRIBUTABLE,
MPI_NODENAME,
MPI_NODENAMES,
MPI_DISTRIBUTABLE,
MPI_RANK,
MPI_SIZE,
APP_DATA,
RES,
ROOT,
START_TIME,
USER,
Mode,
)
from armi.context import Mode

from armi import cli
from armi.meta import __version__
from armi import apps
from armi import pluginManager
from armi import plugins
from armi import runLog
from armi.reactor import flags
from armi.reactor import parameters
from armi.nucDirectory import nuclideBases

import __main__ as main
from armi.reactor import flags, parameters

# ARMI does not configure its own application by default. This is mostly to catch issues
# involving calling code that requires the framework to be configured before that has
Expand Down Expand Up @@ -151,8 +144,7 @@ def init(choice=None, fName=None, cs=None, skipInspection=False):
--------
>>> o = armi.init()
"""
from armi import cases
from armi import settings
from armi import cases, settings

if cs is None:
if fName is None:
Expand All @@ -178,12 +170,8 @@ def getDefaultPlugins() -> List[Type[plugins.ArmiPlugin]]:
This is useful for an application to fold all of the ARMI Framework's capabilities
into its own set of plugins.
"""
from armi import cli
from armi import bookkeeping
from armi.physics import fuelCycle
from armi.physics import neutronics
from armi.physics import safety
from armi import reactor
from armi import bookkeeping, cli, reactor
from armi.physics import fuelCycle, neutronics, safety

defaultPlugins = [
cli.EntryPointsPlugin,
Expand Down
4 changes: 1 addition & 3 deletions armi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"""
import sys

from armi import apps
from armi import configure, isConfigured
from armi import context
from armi import apps, configure, context, isConfigured
from armi.cli import ArmiCLI


Expand Down
23 changes: 11 additions & 12 deletions armi/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
code to access such things through an App object.
"""
# ruff: noqa: E402
from typing import Dict, Optional, Tuple, List
import collections
import importlib
import sys
from typing import Dict, List, Optional, Tuple

from armi import context, plugins, pluginManager, meta, settings
from armi import context, meta, pluginManager, plugins, settings
from armi.reactor import parameters
from armi.reactor.flags import Flags
from armi.settings import fwSettings
from armi.settings import Setting
from armi.settings import Setting, fwSettings


class App:
Expand Down Expand Up @@ -85,14 +84,14 @@ def __init__(self):
self.__initNewPlugins()

def __initNewPlugins(self):
from armi import cli
from armi import bookkeeping
from armi.physics import fuelCycle
from armi.physics import fuelPerformance
from armi.physics import neutronics
from armi.physics import safety
from armi.physics import thermalHydraulics
from armi import reactor
from armi import bookkeeping, cli, reactor
from armi.physics import (
fuelCycle,
fuelPerformance,
neutronics,
safety,
thermalHydraulics,
)

self._pm = plugins.getNewPluginManager()
for plugin in (
Expand Down
12 changes: 7 additions & 5 deletions armi/bookkeeping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ class BookkeepingPlugin(plugins.ArmiPlugin):
@staticmethod
@plugins.HOOKIMPL
def exposeInterfaces(cs):
from armi.bookkeeping import (
historyTracker,
mainInterface,
memoryProfiler,
snapshotInterface,
)
from armi.bookkeeping.db import databaseInterface
from armi.bookkeeping import historyTracker
from armi.bookkeeping import memoryProfiler
from armi.bookkeeping import mainInterface
from armi.bookkeeping import snapshotInterface
from armi.bookkeeping.report import reportInterface

interfaceInfo = []
Expand Down Expand Up @@ -75,8 +77,8 @@ def mpiActionRequiresReset(cmd) -> bool:
--------
armi.operators.operatorMPI.OperatorMPI.workerOperate
"""
from armi.bookkeeping import memoryProfiler
from armi import mpiActions
from armi.bookkeeping import memoryProfiler

if isinstance(cmd, mpiActions.MpiAction):
for donotReset in (
Expand Down
3 changes: 1 addition & 2 deletions armi/bookkeeping/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@
import os

from armi import runLog
from armi.bookkeeping.db.compareDB3 import compareDatabases

# re-export package components for easier import
from armi.bookkeeping.db.database import Database
from armi.bookkeeping.db.database3 import Database3
from armi.bookkeeping.db.databaseInterface import DatabaseInterface
from armi.bookkeeping.db.compareDB3 import compareDatabases
from armi.bookkeeping.db.factory import databaseFactory


__all__ = [
"Database",
"Database3",
Expand Down
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/compareDB3.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
even if the code hasn't changed.
"""
from typing import Sequence, Optional, Pattern, Tuple
import collections
import os
import re
import traceback
from typing import Optional, Pattern, Sequence, Tuple

import h5py
import numpy as np
Expand Down
17 changes: 7 additions & 10 deletions armi/bookkeeping/db/databaseInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@
import pathlib
import time
from typing import (
MutableSequence,
Optional,
Tuple,
Sequence,
MutableSequence,
Tuple,
)

from armi import context
from armi import interfaces
from armi import runLog
from armi import context, interfaces, runLog
from armi.bookkeeping.db.database import Database, getH5GroupName
from armi.reactor.parameters import parameterDefinitions
from armi.bookkeeping.db.typedefs import Histories, History
from armi.reactor.composites import ArmiObject
from armi.bookkeeping.db.typedefs import History, Histories
from armi.utils import getPreviousTimeNode, getStepLengths
from armi.reactor.parameters import parameterDefinitions
from armi.settings.fwSettings.databaseSettings import (
CONF_SYNC_AFTER_WRITE,
CONF_FORCE_DB_PARAMS,
CONF_SYNC_AFTER_WRITE,
)

from armi.utils import getPreviousTimeNode, getStepLengths

ORDER = interfaces.STACK_ORDER.BOOKKEEPING

Expand Down
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import h5py

from armi.bookkeeping.db.database import Database
from armi.bookkeeping.db import permissions
from armi.bookkeeping.db.database import Database


def databaseFactory(dbName: str, permission: str, version: Optional[str] = None):
Expand Down
9 changes: 4 additions & 5 deletions armi/bookkeeping/db/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

import collections
from typing import (
Any,
Dict,
List,
Optional,
Tuple,
Type,
Dict,
Any,
List,
)

import numpy as np
Expand All @@ -41,8 +41,7 @@
from armi.reactor.components import Component
from armi.reactor.composites import ArmiObject
from armi.reactor.excoreStructure import ExcoreStructure
from armi.reactor.reactors import Core
from armi.reactor.reactors import Reactor
from armi.reactor.reactors import Core, Reactor

# Here we store the Database version information.
DB_MAJOR = 3
Expand Down
8 changes: 4 additions & 4 deletions armi/bookkeeping/db/tests/test_comparedb3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
import numpy as np

from armi.bookkeeping.db.compareDB3 import (
_compareSets,
DiffResults,
OutputWriter,
_compareAuxData,
_compareSets,
_diffSimpleData,
_diffSpecialData,
compareDatabases,
DiffResults,
OutputWriter,
)
from armi.bookkeeping.db.databaseInterface import DatabaseInterface
from armi.reactor.tests import test_reactors
from armi.tests import mockRunLogs, TEST_ROOT
from armi.tests import TEST_ROOT, mockRunLogs
from armi.utils.directoryChangers import TemporaryDirectoryChanger


Expand Down
4 changes: 1 addition & 3 deletions armi/bookkeeping/db/tests/test_databaseInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
from numpy.testing import assert_allclose, assert_equal

from armi import __version__ as version
from armi import interfaces
from armi import runLog
from armi import settings
from armi import interfaces, runLog, settings
from armi.bookkeeping.db.database import Database
from armi.bookkeeping.db.databaseInterface import DatabaseInterface
from armi.cases import case
Expand Down
3 changes: 1 addition & 2 deletions armi/bookkeeping/db/tests/test_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import unittest

from armi import context
from armi.bookkeeping.db import database
from armi.bookkeeping.db import layout
from armi.bookkeeping.db import database, layout
from armi.reactor import grids
from armi.utils.directoryChangers import TemporaryDirectoryChanger

Expand Down
3 changes: 1 addition & 2 deletions armi/bookkeeping/db/typedefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Dict, Tuple, Any
from typing import Any, Dict, Tuple

from armi.reactor.composites import ArmiObject
from armi.reactor.grids import LocationBase


# Return type for the getHistories() method
# param time node value
History = Dict[str, Dict[Tuple[int, int], Any]]
Expand Down
10 changes: 4 additions & 6 deletions armi/bookkeeping/historyTracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,19 @@ def getHistoryParams(self):
See :ref:`detail-assems`.
"""
from typing import TYPE_CHECKING
import traceback
from typing import TYPE_CHECKING

from armi import interfaces
from armi import runLog
from armi import operators
from armi.reactor.flags import Flags
from armi import interfaces, operators, runLog
from armi.reactor import grids
from armi.reactor.flags import Flags
from armi.utils import tabulate

ORDER = 2 * interfaces.STACK_ORDER.BEFORE + interfaces.STACK_ORDER.BOOKKEEPING

if TYPE_CHECKING:
from armi.reactor.blocks import Block
from armi.reactor.assemblies import Assembly
from armi.reactor.blocks import Block


def describeInterfaces(cs):
Expand Down
13 changes: 5 additions & 8 deletions armi/bookkeeping/mainInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@
import os
import re

from armi import context
from armi import interfaces
from armi import operators
from armi import runLog
from armi import utils
from armi import context, interfaces, operators, runLog, utils
from armi.bookkeeping.db.database import Database
from armi.settings.fwSettings.globalSettings import CONF_COPY_FILES_FROM
from armi.settings.fwSettings.globalSettings import CONF_COPY_FILES_TO
from armi.settings.fwSettings.globalSettings import (
CONF_COPY_FILES_FROM,
CONF_COPY_FILES_TO,
)
from armi.utils import pathTools
from armi.utils.customExceptions import InputError


ORDER = interfaces.STACK_ORDER.PREPROCESSING


Expand Down
Loading

0 comments on commit 924f8cb

Please sign in to comment.