skypilot-org / skypilot

SkyPilot: Run AI and batch jobs on any infra (Kubernetes or 12+ clouds). Get unified execution, cost savings, and high GPU availability via a simple interface.
https://skypilot.readthedocs.io
Apache License 2.0
6.82k stars 513 forks source link

Add Basic Visualization Support for DAGs #4277

Closed andylizf closed 1 week ago

andylizf commented 2 weeks ago

Implement a simple DAG visualization feature to help users view task dependencies and execution flow. This visualization will make it easier to understand and debug complex DAG structures.

Proposed Solution:

  1. Add a plot method in Dag:

    • Leverage pydot and graphviz for rendering the DAG.
    • Save the generated visualization as an image file (e.g., .png).
    • Display the image inline in Jupyter Notebooks if available.
  2. Key implementation steps:

    • Extract nodes and edges using DFS to ensure unique node names.
    • Build the visualization graph by adding nodes and edges.
    • Provide optional file path for saving the visualization.

Requirements:

References:

Ray’s implementation of DAG visualization could serve as a useful reference for structuring this feature.