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

Expose root node #165

Merged
merged 4 commits into from
Jan 18, 2024
Merged

Expose root node #165

merged 4 commits into from
Jan 18, 2024

Conversation

liamhuber
Copy link
Member

Adds a new instance property Node.root: -> Node that returns the parent-most node in the node's graph. For the parent-most node or nodes all alone, the root is just self.

Access to this sort of graph property seems intrinsically nice to me, but in particular I have in mind to use it for specifying nodes as "checkpoints", i.e. points at which the graphs save themselves, by adding a finally clause to Node._finish_run like:

finally:
    if self.is_checkpoint:
        self.root.save()

I included documentation at the docstring level, but since we don't yet have a use-case (e.g. above) I don't see a need to modify any notebooks or train users on this property.

Copy link

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_workflow/root_node

Copy link

codacy-production bot commented Jan 16, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.02% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b26d224) 2572 2195 85.34%
Head commit (a08e11b) 2575 (+3) 2198 (+3) 85.36% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#165) 3 3 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

Copy link

github-actions bot commented Jan 16, 2024

Pull Request Test Coverage Report for Build 7576748024

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 90.246%

Totals Coverage Status
Change from base Build 7534444490: -0.02%
Covered Lines: 4654
Relevant Lines: 5157

💛 - Coveralls

This was referenced Jan 16, 2024
liamhuber and others added 2 commits January 18, 2024 14:29
We might have a storage root, etc. Also, the graph and the semantics are not identical, as multiple workflows might have a semantic (but not operational) interaction, so then we'd care about a semantic root! Plus it makes find-usages easier on the IDE when we have a more specific name.
@liamhuber liamhuber merged commit dadc69a into main Jan 18, 2024
16 checks passed
@liamhuber liamhuber deleted the root_node branch January 18, 2024 22:59
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.

None yet

2 participants