diff --git a/pyiron_contrib/workflow/channels.py b/pyiron_contrib/workflow/channels.py index fd500e03f..d76f7406b 100644 --- a/pyiron_contrib/workflow/channels.py +++ b/pyiron_contrib/workflow/channels.py @@ -140,6 +140,7 @@ class NotData: is provided; it lets the channel know that it has _no data in it_ and thus should not identify as ready. """ + pass diff --git a/pyiron_contrib/workflow/composite.py b/pyiron_contrib/workflow/composite.py index 612359efa..49e7db78e 100644 --- a/pyiron_contrib/workflow/composite.py +++ b/pyiron_contrib/workflow/composite.py @@ -12,7 +12,12 @@ from pyiron_contrib.workflow.node import Node from pyiron_contrib.workflow.function import ( - Function, SingleValue, Slow, function_node, slow_node, single_value_node + Function, + SingleValue, + Slow, + function_node, + slow_node, + single_value_node, ) from pyiron_contrib.workflow.node_library import atomistics, standard from pyiron_contrib.workflow.node_library.package import NodePackage @@ -74,16 +79,16 @@ class Composite(Node, ABC): # Allows users/devs to easily create new nodes when using children of this class def __init__( - self, - label: str, - *args, - parent: Optional[Composite] = None, - strict_naming: bool = True, - **kwargs + self, + label: str, + *args, + parent: Optional[Composite] = None, + strict_naming: bool = True, + **kwargs, ): super().__init__(*args, label=label, parent=parent, **kwargs) self.strict_naming: bool = strict_naming - self.nodes: DotDict[str: Node] = DotDict() + self.nodes: DotDict[str:Node] = DotDict() self.add: NodeAdder = NodeAdder(self) self.starting_nodes: None | list[Node] = None @@ -96,13 +101,15 @@ def to_dict(self): @property def upstream_nodes(self) -> list[Node]: return [ - node for node in self.nodes.values() + node + for node in self.nodes.values() if node.outputs.connected and not node.inputs.connected ] def on_run(self): - starting_nodes = self.upstream_nodes if self.starting_nodes is None \ - else self.starting_nodes + starting_nodes = ( + self.upstream_nodes if self.starting_nodes is None else self.starting_nodes + ) for node in starting_nodes: node.run() diff --git a/pyiron_contrib/workflow/node.py b/pyiron_contrib/workflow/node.py index 1cdc37f92..ed84532d1 100644 --- a/pyiron_contrib/workflow/node.py +++ b/pyiron_contrib/workflow/node.py @@ -23,28 +23,28 @@ class Node(HasToDict, ABC): """ Nodes are elements of a computational graph. They have input and output data channels that interface with the outside - world, and a callable that determines what they actually compute, and input and - output signal channels that can be used to customize the execution flow of the - graph; + world, and a callable that determines what they actually compute, and input and + output signal channels that can be used to customize the execution flow of the + graph; Together these channels represent edges on the computational graph. - - Nodes can be run to force their computation, or more gently updated, which will + + Nodes can be run to force their computation, or more gently updated, which will trigger a run only if the `run_on_update` flag is set to true and all of the input is ready (i.e. channel values conform to any type hints provided). - - Nodes may have a `parent` node that owns them as part of a sub-graph. - + + Nodes may have a `parent` node that owns them as part of a sub-graph. + Every node must be named with a `label`, and may use this label to attempt to create a working directory in memory for itself if requested. - These labels also help to identify nodes in the wider context of (potentially + These labels also help to identify nodes in the wider context of (potentially nested) computational graphs. - - By default, nodes' signals input comes with `run` and `ran` IO ports which force - the `run()` method and which emit after `finish_run()` is completed, respectfully. - - Nodes have a status, which is currently represented by the `running` and `failed` + + By default, nodes' signals input comes with `run` and `ran` IO ports which force + the `run()` method and which emit after `finish_run()` is completed, respectfully. + + Nodes have a status, which is currently represented by the `running` and `failed` boolean flags. - Their value is controlled automatically in the defined `run` and `finish_run` + Their value is controlled automatically in the defined `run` and `finish_run` methods. This is an abstract class. @@ -95,12 +95,12 @@ class Node(HasToDict, ABC): """ def __init__( - self, - label: str, - *args, - parent: Optional[Composite] = None, - run_on_updates: bool = False, - **kwargs, + self, + label: str, + *args, + parent: Optional[Composite] = None, + run_on_updates: bool = False, + **kwargs, ): """ A mixin class for objects that can form nodes in the graph representation of a