Skip to content

Commit

Permalink
Accumulate run signals with scoped labels not objects
Browse files Browse the repository at this point in the history
  • Loading branch information
liamhuber committed Jan 22, 2024
1 parent 46a5534 commit 4b399d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions pyiron_workflow/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def __init__(
callback: callable,
):
super().__init__(label=label, node=node, callback=callback)
self.received_signals: set[OutputSignal] = set()
self.received_signals: set[str] = set()

def __call__(self, other: OutputSignal) -> None:
"""
Expand All @@ -798,8 +798,14 @@ def __call__(self, other: OutputSignal) -> None:
Resets the collection of received signals when firing.
"""
self.received_signals.update([other])
if len(set(self.connections).difference(self.received_signals)) == 0:
self.received_signals.update([other.scoped_label])
if len(
set(
c.scoped_label for c in self.connections
).difference(
self.received_signals
)
) == 0:
self.reset()
self.callback()

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def test_aggregating_call(self):
):
agg()

out2 = OutputSignal(label="out", node=DummyNode())
out2 = OutputSignal(label="out2", node=DummyNode())
agg.connect(self.out, out2)

self.assertEqual(
Expand Down

0 comments on commit 4b399d1

Please sign in to comment.