Skip to content

Commit

Permalink
Update docstrings and remove unnecessary set
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza committed Jun 11, 2024
1 parent 594a437 commit ab2602e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions haystack/core/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ class Pipeline(PipelineBase):
def _component_has_enough_inputs_to_run(self, name: str, last_inputs: Dict[str, Dict[str, Any]]) -> bool:
"""
Returns True if the Component has all the inputs it needs to run.
:param name: Name of the Component as defined in the Pipeline.
:param last_inputs: The current state of the inputs divided by Component name.
:return: Whether the Component can run or not.
"""
instance: Component = self.graph.nodes[name]["instance"]
if name not in last_inputs:
return False
expected_inputs = set(instance.__haystack_input__._sockets_dict.keys()) # type: ignore
current_inputs = set(last_inputs[name].keys())
if expected_inputs != current_inputs: # type: ignore
expected_inputs = instance.__haystack_input__._sockets_dict.keys() # type: ignore
current_inputs = last_inputs[name].keys()
if expected_inputs != current_inputs:
return False
return True

Expand Down

0 comments on commit ab2602e

Please sign in to comment.