From 2f7a7d06f53884010d98808d913547ff93bf76c2 Mon Sep 17 00:00:00 2001 From: Liam Huber Date: Wed, 31 Jul 2024 13:00:27 -0700 Subject: [PATCH] [patch] Fail to cache when equality comparison throws an exception (#396) E.g. when comparing a numpy array to None. We continue greedily caching, but if it just doesn't work for some reason, the fallback is to simply not cache. Since the current and cached inputs (along with whether or not they generate a cache hit) is always available to the user, I think we still leave enough data for people to debug cache misses on their own. --- pyiron_workflow/node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyiron_workflow/node.py b/pyiron_workflow/node.py index e5f3e955..e6a0f441 100644 --- a/pyiron_workflow/node.py +++ b/pyiron_workflow/node.py @@ -630,7 +630,10 @@ def run_data_tree(self, run_parent_trees_too=False) -> None: @property def cache_hit(self): - return self.inputs.to_value_dict() == self.cached_inputs + try: + return self.inputs.to_value_dict() == self.cached_inputs + except: + return False def _outputs_to_run_return(self): return DotDict(self.outputs.to_value_dict())