From 4b399d1843fb25ae1ca200c4d2c6d9923b13f999 Mon Sep 17 00:00:00 2001 From: liamhuber Date: Mon, 22 Jan 2024 14:38:16 -0800 Subject: [PATCH 1/2] Accumulate run signals with scoped labels not objects --- pyiron_workflow/channels.py | 12 +++++++++--- tests/unit/test_channels.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pyiron_workflow/channels.py b/pyiron_workflow/channels.py index d60853cb..1055df95 100644 --- a/pyiron_workflow/channels.py +++ b/pyiron_workflow/channels.py @@ -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: """ @@ -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() diff --git a/tests/unit/test_channels.py b/tests/unit/test_channels.py index b501875b..341badc8 100644 --- a/tests/unit/test_channels.py +++ b/tests/unit/test_channels.py @@ -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( From 651c2bdb8808abd92e8672b3bbec3143baa538ce Mon Sep 17 00:00:00 2001 From: pyiron-runner Date: Mon, 22 Jan 2024 22:50:41 +0000 Subject: [PATCH 2/2] Format black --- pyiron_workflow/channels.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyiron_workflow/channels.py b/pyiron_workflow/channels.py index 1055df95..74d7c5a6 100644 --- a/pyiron_workflow/channels.py +++ b/pyiron_workflow/channels.py @@ -799,13 +799,14 @@ def __call__(self, other: OutputSignal) -> None: Resets the collection of received signals when firing. """ self.received_signals.update([other.scoped_label]) - if len( - set( - c.scoped_label for c in self.connections - ).difference( - self.received_signals + if ( + len( + set(c.scoped_label for c in self.connections).difference( + self.received_signals + ) ) - ) == 0: + == 0 + ): self.reset() self.callback()