Skip to content
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

Resourcegraph #223

Merged
merged 8 commits into from
Nov 7, 2022
Merged

Resourcegraph #223

merged 8 commits into from
Nov 7, 2022

Conversation

dylanjm
Copy link
Collaborator

@dylanjm dylanjm commented Nov 2, 2022


Pull Request Description

What issue does this change request address?

#163

What are the significant changes in functionality due to this change request?

This PR implements the ability to create a resource graph png during a debug mode run


For Change Control Board: Change Request Review

The following review must be completed by an authorized member of the Change Control Board.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large tes.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added, the the analytic documentation must be updated/added.
  • 9. If any test used as a basis for documentation examples have been changed, the associated documentation must be reviewed and assured the text matches the example.

@dylanjm
Copy link
Collaborator Author

dylanjm commented Nov 2, 2022

Here is what the plots look like:

image

@@ -154,13 +168,14 @@ def main():
sim.read_input(args.xml_input_file) # TODO expand to use arguments?
# print details
sim.print_me()
sim.plot_resource_graph()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be fine initially, but I think this network graph should be something we do at the HERON compilation stage instead of during dispatch optimization. How hard would it be to move?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is creating the plot during HERON compilation. If debug mode is enabled it will create the plot when running heron heron_input.xml

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right, I'm sorry. I saw sim.print_me() and immediately thought of the pyomo model. I should have looked more closely! I'm still on travel but can review this tomorrow or Friday probably.

Copy link
Collaborator

@dgarrett622 dgarrett622 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a cool addition. The code looks good, I did have one comment on the function annotations. I think a test case is warranted for this change. A short blurb in the documentation about this new feature would be good too.

in a HERON system.
"""

def __init__(self, components: list) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you added annotations to method definitions (-> and the like). It is PEP compliant (3107) and I think it adds some valuable information, especially to developers at a quick glance. I haven't seen these annotations elsewhere in HERON, should we standardize this practice going forward? What I mean is, should we include these annotations going forward or remove them? I would vote for including them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree. I like having the annotations and the more detailed we can be with them, the more easy our code would be to understand. Perhaps maybe a soft encouragement to use them going forward? We could easily add a pylint type checking test to our Precheck on CIVET if we wanted to make it a hard standard. @PaulTalbot-INL @joshua-cogliati-inl do you have any specific ideas or reservations about this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not ready to codify it as required practice, but I certainly am happy to see it added where possible. If forced into a decision, I would prefer to include them, but it will take time and opportunity to convert existing code to this standard. I would also like to re-think the RAVEN approach to docstrings at the same time, since this info is largely included in the type hints, but that represents a significant change for a lot of code, possibly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with optionally adding typing annotations. We should add checking them with mypy or pyright or similar before making them required.

@dgarrett622 dgarrett622 linked an issue Nov 2, 2022 that may be closed by this pull request
10 tasks
@PaulTalbot-INL
Copy link
Collaborator

@dgarrett622 are you available to finish the review of this PR?

@dgarrett622
Copy link
Collaborator

Everything looks good to go. I'll get this merged in momentarily. Thanks @j-bryan and @dylanjm!

@dgarrett622 dgarrett622 merged commit 18ae727 into idaholab:devel Nov 7, 2022
@dylanjm dylanjm deleted the resourcegraph branch April 11, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Visualize the graph of components and resources
5 participants