class_docstr: Components orchestration engine.
  
  Builds a graph of components and orchestrates their execution according to the execution graph.
class_docstr_tok: ["Components","orchestration","engine",".","Builds","a","graph","of","components","and","orchestrates","their","execution","according","to","the","execution","graph","."]
docstr: Returns True if a component is ready to run, False otherwise.
docstr_tok: ["Returns","True","if","a","component","is","ready","to","run",",","False","otherwise","."]
code: def _ready_to_run(
      self,
      component_name: str,
      mandatory_values_buffer: Dict[Connection, Any],
      components_queue: List[str],
  ) -> bool:
      """
      Returns True if a component is ready to run, False otherwise.
      """
      connections_with_value = {
          conn
          for conn in mandatory_values_buffer.keys()
          if conn.receiver == component_name
      }
      expected_connections = set(
          self._mandatory_connections[component_name]
      )
      if expected_connections.issubset(connections_with_value):
          logger.debug(
              "Component '%s' is ready to run. All mandatory values were received.",
              component_name,
          )
          return True
  
      # Collect the missing values still being computed we need to wait for
      missing_connections: Set[Connection] = (
          expected_connections - connections_with_value
      )
      connections_to_wait = []
      for missing_conn in missing_connections:
          if any(
              networkx.has_path(
                  self.graph, component_to_run, missing_conn.sender
              )
              for component_to_run in components_queue
          ):
              connections_to_wait.append(missing_conn)
  
      if not connections_to_wait:
          # None of the missing values are needed to visit this part of the graph: we can run the component
          logger.debug(
              "Component '%s' is ready to run. A variadic input parameter received all the expected values.",
              component_name,
          )
          return True
  
      # Component can't run, waiting for the values needed by `connections_to_wait`
      logger.debug(
          "Component '%s' is not ready to run, some values are still missing: %s",
          component_name,
          connections_to_wait,
      )
      # Put the component back in the queue
      components_queue.append(component_name)
      return False
  
imports: from typing import Optional, Any, Dict, List, Union, TypeVar, Type, Set
  import os
  import json
  import datetime
  import logging
  import importlib
  from pathlib import Path
  from copy import deepcopy
  from collections import defaultdict
  import networkx
  from haystack.core.component import component, Component, InputSocket, OutputSocket
  from haystack.core.errors import PipelineError, PipelineConnectError, PipelineMaxLoops, PipelineRuntimeError, PipelineValidationError
  from haystack.core.pipeline.descriptions import find_pipeline_outputs
  from haystack.core.pipeline.draw.draw import _draw, RenderingEngines
  from haystack.core.pipeline.validation import validate_pipeline_input, find_pipeline_inputs
  from haystack.core.component.connection import Connection, parse_connect_string
  from haystack.core.type_utils import _type_name
  from haystack.core.serialization import component_to_dict, component_from_dict
label_desc: Use image node_id 18 for calling the Pipeline obj's underlying member method code with example usage: obj._ready_to_run(component_name, mandatory_values_buffer, components_queue) and returns: False, True, True