From fcb7843bb34222e2d32d4f01f969c49fbb1b05ec Mon Sep 17 00:00:00 2001 From: John Stilley <1831479+john-science@users.noreply.github.com> Date: Fri, 24 Sep 2021 11:34:49 -0700 Subject: [PATCH] Fixing the example gallery in our docs. (#418) * #417 fixed 5 of the 6 gallery images * Fail the build if you break the docs * Inserting a default thumbnail for the MCNP example * We have unit tests for import resolution issues --- .github/workflows/docs.yaml | 1 - .gitignore | 1 + doc/conf.py | 2 ++ .../analysis/run_blockMcnpMaterialCard.py | 8 +++++++- doc/gallery-src/analysis/run_hexReactorToRZ.py | 12 ++++++++---- doc/gallery-src/framework/run_fuelManagement.py | 8 +++++++- .../framework/run_programmaticReactorDefinition.py | 9 ++++++++- doc/gallery-src/framework/run_reactorFacemap.py | 8 +++++++- 8 files changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 50697500c..a206a191e 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -26,7 +26,6 @@ jobs: run: pip install tox - name: Make HTML Docs run: tox -e doc - continue-on-error: true - name: deploy uses: JamesIves/github-pages-deploy-action@4.1.5 with: diff --git a/.gitignore b/.gitignore index e47b4d25b..b8c48ccc5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ doc/tutorials/case-suite armi/tests/tutorials/case-suite .apidocs/ doc/gallery +doc/gallery-src/framework/*.yaml htmlcov/ # No workspace crumbs. diff --git a/doc/conf.py b/doc/conf.py index 17a83e539..04b9dda42 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -399,6 +399,8 @@ def setup(app): "default_thumb_file": os.path.join(RES, "images", "TerraPowerLogo.png"), } +suppress_warnings: ["autoapi.python_import_resolution"] + # filter out this warning which shows up in sphinx-gallery builds. # this is suggested in the sphinx-gallery example but doesn't actually work? warnings.filterwarnings( diff --git a/doc/gallery-src/analysis/run_blockMcnpMaterialCard.py b/doc/gallery-src/analysis/run_blockMcnpMaterialCard.py index 7c79d2fe8..10b1855c2 100644 --- a/doc/gallery-src/analysis/run_blockMcnpMaterialCard.py +++ b/doc/gallery-src/analysis/run_blockMcnpMaterialCard.py @@ -9,13 +9,19 @@ plugin. But in this case, the need for MCNP materials cards is so pervasive that it made it into the framework. """ +# sphinx_gallery_thumbnail_path = '.static/armi-logo.png' +import logging from armi.reactor.tests import test_reactors from armi.reactor.flags import Flags from armi.utils.densityTools import formatMaterialCard from armi.nucDirectory import nuclideBases as nb -from armi import configure +from armi import configure, runLog +# init ARMI logging tools +logging.setLoggerClass(runLog.RunLogger) + +# configure ARMI configure(permissive=True) _o, r = test_reactors.loadTestReactor() diff --git a/doc/gallery-src/analysis/run_hexReactorToRZ.py b/doc/gallery-src/analysis/run_hexReactorToRZ.py index 8180dc078..7550323f4 100644 --- a/doc/gallery-src/analysis/run_hexReactorToRZ.py +++ b/doc/gallery-src/analysis/run_hexReactorToRZ.py @@ -4,14 +4,14 @@ This shows how an entire reactor specified in full hex detail can be automatically converted to a 2-D or 3-D RZ case with conserved mass. -.. warning:: +.. warning:: This uses :py:mod:`armi.reactor.converters.geometryConverters`, which will only work on a constrained set of hex-based geometries. For your systems, consider these an example and starting point and build your own converters as appropriate. - - """ +import logging + # sphinx_gallery_thumbnail_number=2 import math @@ -21,8 +21,12 @@ from armi.reactor.flags import Flags from armi.reactor.converters import geometryConverters from armi.utils import plotting -from armi import configure +from armi import configure, runLog + +# init ARMI logging tools +logging.setLoggerClass(runLog.RunLogger) +# configure ARMI configure(permissive=True) o, r = test_reactors.loadTestReactor() diff --git a/doc/gallery-src/framework/run_fuelManagement.py b/doc/gallery-src/framework/run_fuelManagement.py index bf8606726..4d153d582 100644 --- a/doc/gallery-src/framework/run_fuelManagement.py +++ b/doc/gallery-src/framework/run_fuelManagement.py @@ -15,6 +15,8 @@ demonstration purposes. """ +import logging + # Tell the gallery to feature the 2nd image # sphinx_gallery_thumbnail_number = 2 import math @@ -24,8 +26,12 @@ from armi.physics.fuelCycle import fuelHandlers from armi.utils import plotting -from armi import configure +from armi import configure, runLog + +# init ARMI logging tools +logging.setLoggerClass(runLog.RunLogger) +# configure ARMI configure(permissive=True) o, reactor = test_reactors.loadTestReactor(inputFileName="refTestCartesian.yaml") diff --git a/doc/gallery-src/framework/run_programmaticReactorDefinition.py b/doc/gallery-src/framework/run_programmaticReactorDefinition.py index 1624285e6..4850493b5 100644 --- a/doc/gallery-src/framework/run_programmaticReactorDefinition.py +++ b/doc/gallery-src/framework/run_programmaticReactorDefinition.py @@ -15,10 +15,17 @@ from scratch. """ +import logging + import matplotlib.pyplot as plt -from armi import configure +from armi import configure, runLog + +# init ARMI logging tools +logging.setLoggerClass(runLog.RunLogger) +# configure ARMI configure(permissive=True) + # pylint: disable=wrong-import-position from armi.reactor import blueprints from armi import settings diff --git a/doc/gallery-src/framework/run_reactorFacemap.py b/doc/gallery-src/framework/run_reactorFacemap.py index 5429db8f8..5fbd5ff41 100644 --- a/doc/gallery-src/framework/run_reactorFacemap.py +++ b/doc/gallery-src/framework/run_reactorFacemap.py @@ -5,10 +5,16 @@ Load a test reactor from the test suite and plot a dummy power distribution from it. You can plot any block parameter. """ +import logging + from armi.reactor.tests import test_reactors from armi.utils import plotting -from armi import configure +from armi import configure, runLog + +# init ARMI logging tools +logging.setLoggerClass(runLog.RunLogger) +# configure ARMI configure(permissive=True) operator, reactor = test_reactors.loadTestReactor()