Skip to content

Commit

Permalink
Merge branch 'main' into code_cov_20220916
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Jan 4, 2023
2 parents fbd537b + 767773e commit 13f65ae
Show file tree
Hide file tree
Showing 268 changed files with 18,210 additions and 25,911 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Expand Up @@ -6,6 +6,9 @@ omit =
armi/utils/tests/test_gridGui.py
venv/
source = armi
# change default .coverage file to something that doesn't have a dot
# because the Windows file server can't handle dots.
data_file = coverage_results.cov

[coverage:run]
parallel = true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/black.yaml
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
# use workaround due to: https://github.com/psf/black/issues/2079#issuecomment-812359146
jobs:
check-formatting:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/coverage.yaml
@@ -1,14 +1,19 @@
name: Coverage

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

steps:
- uses: actions/checkout@v2
Expand All @@ -25,5 +30,18 @@ jobs:
- name: Run Coverage Part 1
run: tox -e cov1 || true
- name: Run Coverage Part 2
run: tox -e cov2,report
run: tox -e cov2
- name: Convert Coverage Results
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
pip install click==8.1.3
pip install coverage==6.5.0
pip install coveragepy-lcov==0.1.2
coveragepy-lcov --data_file_path coverage_results.cov --output_file_path lcov.txt
- name: Publish to coveralls.io
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.txt

4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Expand Up @@ -8,14 +8,14 @@ on:
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Update package index
run: sudo apt-get update
- name: Install mpi libs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/licensechecker.yaml
Expand Up @@ -2,7 +2,7 @@ name: Check License Lines
on: [push, pull_request]
jobs:
check-license-lines:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Check License Lines
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yaml
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python: [3.7, 3.8, 3.9, '3.10']
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validatemanifest.yaml
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -48,6 +48,7 @@ tags
.pytest_cache/
pytestdebug.log
dump-temp-*
dump-tests*
.vim-bookmarks
venv*/
.mypy_cache/
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Expand Up @@ -27,9 +27,7 @@ include armi/nuclearDataIO/tests/library-file-generation/mc2v2-dlayxs.inp
include armi/nuclearDataIO/tests/library-file-generation/mc2v3-AA.inp
include armi/nuclearDataIO/tests/library-file-generation/mc2v3-AB.inp
include armi/nuclearDataIO/tests/library-file-generation/mc2v3-dlayxs.inp
include armi/nuclearDataIO/tests/longLivedRipleData.dat
include armi/nuclearDataIO/tests/simple_hexz.inp
include armi/nuclearDataIO/tests/z036.dat
include armi/tests/1DslabXSByCompTest.yaml
include armi/tests/COMPXS.ascii
include armi/tests/ISOAA
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -434,6 +434,6 @@ only use third-party Python libraries that have MIT or BSD licenses.
.. |Build Status| image:: https://github.com/terrapower/armi/actions/workflows/unittests.yaml/badge.svg?branch=main
:target: https://github.com/terrapower/armi/actions/workflows/unittests.yaml

.. |Code Coverage| image:: https://coveralls.io/repos/github/terrapower/armi/badge.svg?branch=main&kill_cache=7
.. |Code Coverage| image:: https://coveralls.io/repos/github/terrapower/armi/badge.svg?branch=main&kill_cache=2
:target: https://coveralls.io/github/terrapower/armi?branch=main

2 changes: 0 additions & 2 deletions armi/_bootstrap.py
Expand Up @@ -57,8 +57,6 @@ def _addCustomTabulateTables():
_addCustomTabulateTables()


from armi import runLog

from armi.nucDirectory import nuclideBases

# Nuclide bases get built explicitly here to have better determinism
Expand Down
4 changes: 2 additions & 2 deletions armi/bookkeeping/__init__.py
Expand Up @@ -22,7 +22,7 @@ class BookkeepingPlugin(plugins.ArmiPlugin):
@staticmethod
@plugins.HOOKIMPL
def exposeInterfaces(cs):
from armi.bookkeeping.db import database3
from armi.bookkeeping.db import databaseInterface
from armi.bookkeeping import historyTracker
from armi.bookkeeping import memoryProfiler
from armi.bookkeeping import mainInterface
Expand All @@ -31,7 +31,7 @@ def exposeInterfaces(cs):

interfaceInfo = []
interfaceInfo += plugins.collectInterfaceDescriptions(mainInterface, cs)
interfaceInfo += plugins.collectInterfaceDescriptions(database3, cs)
interfaceInfo += plugins.collectInterfaceDescriptions(databaseInterface, cs)
interfaceInfo += plugins.collectInterfaceDescriptions(historyTracker, cs)
interfaceInfo += plugins.collectInterfaceDescriptions(memoryProfiler, cs)
interfaceInfo += plugins.collectInterfaceDescriptions(reportInterface, cs)
Expand Down
85 changes: 48 additions & 37 deletions armi/bookkeeping/db/__init__.py
Expand Up @@ -18,39 +18,47 @@
As an ARMI run progresses, this is periodically updated as the primary output file.
It can also be an input file for follow-on analysis or restart runs.
The database can be visualized through various tools such as XTVIEW.
This module contains factories for selecting and building DB-related objects.
Some notes on versions
----------------------
Persistent storage of ARMI models has seen many changes throughout the years.
Calculation results were originally stored on a SQL database (version 1), which has been
fully deprecated at this point.
Version 2 was the first to use HDF5 as the primary storage format. This was beneficial,
as it did not rely on any external infrastructure to operate, and benefited from the
suite of tools that help interact with HDF5 files. It was eventually replaced because
it did not store a complete model of the reactor, but rather a ghost of assembly, block,
and reactor parameters that could be applied to an existing reactor model (so long as
the dimensions were consistent!). This led to loading reactors being inconvenient and
error-prone, and also posed a limitation for representing more complex systems that have
non-core components.
Version 3 was created to make the schema more flexible and to permit storing the entire
reactor model within the HDF5 file. All objects in the ARMI Composite Model are written
to the database, and the model can be recovered in its entirety just from the HDF5 file.
Since it's inception, it has seen a number of tweaks to improve its functionality and
fix bugs.
Being a serialization format, the code associated with reading and writing database
files may not benefit from Don't Repeat Yourself (DRY) practices in the same way as
other code. Therefore, we do not share much, if any, code between different major
versions of the databases. As such, new major-versioned database implementations should
exist in their own modules. Minor revisions (e.g. M.(N+1)) to the database structure
should be simple enough that specialized logic can be used to support all minor versions
without posing a maintenance burden. A detailed change log should be maintained of each
minor revision.
When updating a db version
--------------------------
The code associated with reading and writing database files may not benefit from Don't
Repeat Yourself (DRY) practices in the same way as other code. Therefore, do not share
code between different major versions of the databases. Create a new module if you are
creating a new major database version.
Database revision changelog
---------------------------
- 1: Originally, calculation results were stored in a SQL database.
- 2: The storage format was changed to HDF5. This required less external
infrastructure than SQL. However, the implementation did not store a complete
model of a reactor, but a ghost of assembly, block, and reactor parameters that
could be applied to an existing reactor model (so long as the dimensions were
consistent). This was inconvenient and error prone.
- 3: The HDF5 format was kept, but the schema was made more flexible to permit
storing the entire reactor model. All objects in the ARMI Composite Model are
written to the database, and the model can be completely recovered from just the
HDF5 file.
- 3.1: Improved the handling of reading/writing grids.
- 3.2: Changed the strategy for storing large attributes to using a special
string starting with an "@" symbol (e.g., "@/c00n00/attrs/5_linkedDims"). This
was done to support copying time node datasets from one file to another without
invalidating the references. Support was maintained for reading previous
versions, by performing a ``mergeHistory()`` and converting to the new naming
strategy, but the old version cannot be written.
- 3.3: Compressed the way locations are stored in the database and allow
MultiIndex locations to be read and written.
- 3.4: Modified the way locations are stored in the database to include complete
indices for indices that can be composed from multiple grids. Having complete
indices allows for more efficient means of extracting information based on
location, without having to compose the full model.
"""
import os
from typing import Optional, List, Tuple
Expand All @@ -62,7 +70,8 @@

# re-export package components for easier import
from .permissions import Permissions
from .database3 import Database3, DatabaseInterface, updateGlobalAssemblyNum
from .database3 import Database3, updateGlobalAssemblyNum
from .databaseInterface import DatabaseInterface
from .compareDB3 import compareDatabases
from .factory import databaseFactory

Expand Down Expand Up @@ -145,11 +154,13 @@ def loadOperator(pathToDb, loadCycle, loadNode, allowMissing=False):
updateGlobalAssemblyNum(r)

o = thisCase.initializeOperator(r=r)
runLog.warning(
"The operator provided is not in the same state as the operator was.\n"
"When the reactor was at the prescribed cycle and node, it should have\n"
"access to the same interface stack, but the interfaces will also not be in the "
"same state.\n"
runLog.important(
"The operator will not be in the same state that it was at that cycle and "
"node, only the reactor.\n"
"The operator should have access to the same interface stack, but the "
"interfaces will not be in the same state (they will be fresh instances "
"of each interface as if __init__ was just called rather than the state "
"during the run at this time node.)\n"
"ARMI does not support loading operator states, as they are not stored."
)
return o
Expand Down
17 changes: 8 additions & 9 deletions armi/bookkeeping/db/compareDB3.py
Expand Up @@ -289,17 +289,14 @@ def _compareSets(
src: set, ref: set, out: OutputWriter, name: Optional[str] = None
) -> int:
nDiffs = 0
printName = "" if name is None else name + " "
if ref - src:
nDiffs += len(ref - src)
out.writeln(
"ref has {}not in src: {}".format(name + " " or "", list(ref - src))
)
out.writeln("ref has {}not in src: {}".format(printName, list(ref - src)))

if src - ref:
nDiffs += len(ref - src)
out.writeln(
"src has {}not in ref: {}".format(name + " " or "", list(src - ref))
)
nDiffs += len(src - ref)
out.writeln("src has {}not in ref: {}".format(printName, list(src - ref)))

return nDiffs

Expand Down Expand Up @@ -493,8 +490,10 @@ def _compareComponentData(

if srcSpecial ^ refSpecial:
out.writeln(
"Could not compare data because one uses special formatting, "
"and the other does not. Ref: {} Src: {}".format(refSpecial, srcSpecial)
"Could not compare data for parameter {} because one uses special "
"formatting, and the other does not. Ref: {} Src: {}".format(
paramName, refSpecial, srcSpecial
)
)
diffResults.addDiff(
refGroup.name, paramName, numpy.inf, numpy.inf, numpy.inf
Expand Down

0 comments on commit 13f65ae

Please sign in to comment.