pyiron / pyiron_workflow

Graph-and-node based workflows
BSD 3-Clause "New" or "Revised" License
10 stars 1 forks source link

[minor] Prune macro IO nodes that don't get forked #277

Closed liamhuber closed 2 months ago

liamhuber commented 2 months ago

For the sake of computational efficiency, have macro IO value-link directly to child node IO wherever possible.

As promised in an aside in #268, this slides on top of #276 quite nicely.

Before we always had IO nodes:

from pyiron_workflow import Workflow

@Workflow.wrap_as.macro_node("l", "r")
def double(macro, a, b, c):
    return a + b, b + c

m = double()
fig = m.draw(size=(10, 10))
fig.render(filename="before", format="png")  # Or "after"

before

Now, you can see that we only keep the node where it's useful, i.e. where we actually want a node present so the input can be forked with multiple different connections:

after

github-actions[bot] commented 2 months ago

Binder :point_left: Launch a binder notebook on branch _pyiron/pyiron_workflow/efficient_macrointerface

codacy-production[bot] commented 2 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.04% (target: -1.00%) :white_check_mark: 100.00%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (92f0c6cc1e60ab052b3b2ad046de08b628609c55) | 3442 | 2998 | 87.10% | | | Head commit (adf3bed79e57469a218d2da1fd1e3493571ccb87) | 3453 (+11) | 3009 (+11) | 87.14% (**+0.04%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#277) | 13 | 13 | **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: `/ * 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