-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New plugin hook for before reactor construction #1945
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opotowsky
added
the
architecture
Issues related to big picture system architecture
label
Oct 10, 2024
opotowsky
commented
Oct 10, 2024
Here's a patch that will get at least some test coverage. It's not easy to confirm positively that the reactor doesn't exist because the plugin hook has no knowledge of that. I think just showing that it's run during init is probably sufficient. diff --git a/armi/tests/test_user_plugins.py b/armi/tests/test_user_plugins.py
index 0840afd5..0cc19f0d 100644
--- a/armi/tests/test_user_plugins.py
+++ b/armi/tests/test_user_plugins.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for the UserPlugin class."""
+
import copy
import os
import unittest
@@ -106,6 +107,11 @@ class UserPluginOnProcessCoreLoading(plugins.UserPlugin):
for b in blocks:
b.p.height += 1.0
+ @staticmethod
+ @plugins.HOOKIMPL
+ def beforeReactorConstruction(cs) -> None:
+ cs._beforeReactorConstructionFlag = True
+
class UpInterface(interfaces.Interface):
"""
@@ -248,6 +254,7 @@ class TestUserPlugins(unittest.TestCase):
TEST_ROOT, inputFileName="smallestTestReactor/armiRunSmallest.yaml"
)
fuels = r.core.getBlocks(Flags.FUEL)
+ self.assertTrue(o.cs._beforeReactorConstructionFlag)
# prove that our plugin affects the core in the desired way
heights = [float(f.p.height) for f in fuels] |
john-science
approved these changes
Oct 14, 2024
Co-authored-by: John Stilley <1831479+john-science@users.noreply.github.com>
…into new-plugin-hook
drewj-tp
added a commit
that referenced
this pull request
Oct 15, 2024
* origin/main: New plugin hook for before reactor construction (#1945)
drewj-tp
added a commit
that referenced
this pull request
Oct 16, 2024
…xial-linkage * origin/main: New plugin hook for before reactor construction (#1945) Removing DoseResultsMapper (#1952) Adding logic so HexAssemblies are hexagonal (#1935) Adding Block.getInputHeight (#1927) Removing Assembly.doubleResolution (#1951) Adding DeprecationWarning for HistoryTrackerInterface (#1950) Removing tabulate as a dependency (#1948)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the change?
This adds a new plugin hook
beforeReactorConstruction
. Then some code (material namespace order setting) is pulled out of the reactor factory and into the hook call for the reactor plugin.Why is the change being made?
This cleans up the reactor construction and sets the stage for plugins to fancify the
beforeReactorConstruction
hook should they be interested in fancification.Checklist
doc
folder.pyproject.toml
.