@@ -657,7 +657,7 @@ def outputs(self, include_components_with_connected_outputs: bool = False) -> Di
657657 }
658658 return outputs
659659
660- def show (self , server_url : str = "https://mermaid.ink" , params : Optional [dict ] = None ) -> None :
660+ def show (self , server_url : str = "https://mermaid.ink" , params : Optional [dict ] = None , timeout : int = 30 ) -> None :
661661 """
662662 Display an image representing this `Pipeline` in a Jupyter notebook.
663663
@@ -683,19 +683,24 @@ def show(self, server_url: str = "https://mermaid.ink", params: Optional[dict] =
683683 - paper: Paper size for PDFs (e.g., 'a4', 'a3'). Ignored if 'fit' is true.
684684 - landscape: Landscape orientation for PDFs (boolean). Ignored if 'fit' is true.
685685
686+ :param timeout:
687+ Timeout in seconds for the request to the Mermaid server.
688+
686689 :raises PipelineDrawingError:
687690 If the function is called outside of a Jupyter notebook or if there is an issue with rendering.
688691 """
689692 if is_in_jupyter ():
690693 from IPython .display import Image , display # type: ignore
691694
692- image_data = _to_mermaid_image (self .graph , server_url = server_url , params = params )
695+ image_data = _to_mermaid_image (self .graph , server_url = server_url , params = params , timeout = timeout )
693696 display (Image (image_data ))
694697 else :
695698 msg = "This method is only supported in Jupyter notebooks. Use Pipeline.draw() to save an image locally."
696699 raise PipelineDrawingError (msg )
697700
698- def draw (self , path : Path , server_url : str = "https://mermaid.ink" , params : Optional [dict ] = None ) -> None :
701+ def draw (
702+ self , path : Path , server_url : str = "https://mermaid.ink" , params : Optional [dict ] = None , timeout : int = 30
703+ ) -> None :
699704 """
700705 Save an image representing this `Pipeline` to the specified file path.
701706
@@ -721,12 +726,15 @@ def draw(self, path: Path, server_url: str = "https://mermaid.ink", params: Opti
721726 - paper: Paper size for PDFs (e.g., 'a4', 'a3'). Ignored if 'fit' is true.
722727 - landscape: Landscape orientation for PDFs (boolean). Ignored if 'fit' is true.
723728
729+ :param timeout:
730+ Timeout in seconds for the request to the Mermaid server.
731+
724732 :raises PipelineDrawingError:
725733 If there is an issue with rendering or saving the image.
726734 """
727735 # Before drawing we edit a bit the graph, to avoid modifying the original that is
728736 # used for running the pipeline we copy it.
729- image_data = _to_mermaid_image (self .graph , server_url = server_url , params = params )
737+ image_data = _to_mermaid_image (self .graph , server_url = server_url , params = params , timeout = timeout )
730738 Path (path ).write_bytes (image_data )
731739
732740 def walk (self ) -> Iterator [Tuple [str , Component ]]:
0 commit comments