-
Notifications
You must be signed in to change notification settings - Fork 37
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
Refactoring template driver to dynamically create RAVEN workflows #391
Conversation
Wow, this is quite an effort! Do you have any diagramming or writeup for the logic flow? I think it's starting to make sense glancing over it, but some developer documentation would help get us up to speed on this new structure. Thanks for your work on this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes and discussion points. I read heavily my assigned sections and then did a quick look over the rest of the files. I will review once more when all changes are submitted.
I was thinking, it might be nice to add some linting checks to our automated testing. Nothing that stops the tests from running, but just checking to make sure we are consistent. Almost like a coverage summary but for linting. @joshua-cogliati-inl @caleb-sitton-inl what are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments on templates/snippets
templates/snippets/base.py
Outdated
@classmethod | ||
def from_xml(cls, node: ET.Element, **kwargs) -> "RavenSnippet": | ||
""" | ||
Alternate constructor which instantiates a new RavenSnippet objectfrom .n existing XML node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "objectfrom .n existing" be "object from an existing"?
templates/snippets/base.py
Outdated
|
||
class RavenSnippet(ET.Element): | ||
""" | ||
RavenSnippet class objects describe one contiguous snippet of RAVEN XML, inheritingfrom .he xml.etree.ElementTree.Element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "inheritingfrom .he" be "inheriting from the"?
templates/snippets/distributions.py
Outdated
|
||
def distribution_class_from_spec(spec) -> type[Distribution]: | ||
""" | ||
Make a new distribution classfrom .he RAVEN input spec for that class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "classfrom .he" to "class from the"?
templates/snippets/files.py
Outdated
@ In, value, str, the type value to set | ||
@ Out, None | ||
""" | ||
self.set("type", str(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the type of value is str, why is str(value)
needed? (Ditto for "path")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unnecessary as long as the input type is respected. I'll remove in the interest of cleaner code.
We use pylint on RAVEN, so this seems reasonable. (pylint is available in conda and pypi) |
I was aware of pylint but hadn't made much use of it before. I was looking through some issues it brought up in my code for this PR and fixed some of the issues it brought up. I agree it would be good to add in a way similar to how it's used by RAVEN. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of linting errors, some comments and questions. Fantastic work so far, big fan of the changes
tests/integration_tests/mechanics/debug_mode/gold/dispatch_print.csv
Outdated
Show resolved
Hide resolved
tests/integration_tests/mechanics/pyomo_options/gold/Sweep_Runs_o/sweep.csv
Outdated
Show resolved
Hide resolved
tests/integration_tests/mechanics/test_cashplot/gold/Runs_o/dispatch.nc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed HERON/tests/unit_tests/snippets and HERON/templates/xml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two minor changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking these changes look pretty good. Nothing stands out to me to halt this PR any further. Tests have been added for new functionality and features remain compatible with previous versions of HERON, so no need for a user group email (since this is more of a developer improvement anyway.)
Jacob addressed Gabe's comments.
Pull Request Description
What issue does this change request address?
#390
What are the significant changes in functionality due to this change
This pull request restructures the templating system used to generate RAVEN workflows.
For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.