Skip to content

Commit

Permalink
fix: do not dump pipeline graph into the debug payload (#6528)
Browse files Browse the repository at this point in the history
  • Loading branch information
masci authored Dec 12, 2023
1 parent 09abcc1 commit a55024b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 0 additions & 8 deletions haystack/core/pipeline/draw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def _draw(
logger.debug("Pipeline diagram saved at %s", path)


def _convert_for_debug(graph: networkx.MultiDiGraph) -> Any:
"""
Renders the pipeline graph with additional debug information into a text file that Mermaid can later render.
"""
graph = _prepare_for_drawing(graph=graph, style_map={})
return _to_mermaid_text(graph=graph)


def _convert(
graph: networkx.MultiDiGraph, engine: RenderingEngines = "mermaid-image", style_map: Optional[Dict[str, str]] = None
) -> Any:
Expand Down
4 changes: 1 addition & 3 deletions haystack/core/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
PipelineValidationError,
)
from haystack.core.pipeline.descriptions import find_pipeline_outputs
from haystack.core.pipeline.draw.draw import _draw, _convert_for_debug, RenderingEngines
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
Expand Down Expand Up @@ -519,14 +519,12 @@ def _record_pipeline_step(
"""
Stores a snapshot of this step into the self.debug dictionary of the pipeline.
"""
mermaid_graph = _convert_for_debug(deepcopy(self.graph))
self._debug[step] = {
"time": datetime.datetime.now(),
"components_queue": components_queue,
"mandatory_values_buffer": mandatory_values_buffer,
"optional_values_buffer": optional_values_buffer,
"pipeline_output": pipeline_output,
"diagram": mermaid_graph,
}

def _clear_visits_count(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
issues:
- |
Fix "TypeError: descriptor '__dict__' for 'XXX' objects doesn't apply to a 'XXX' object" when running
pipelines with `debug=True` by removing the graph image from the debug payload.

0 comments on commit a55024b

Please sign in to comment.