diff --git a/python/ray/dag/dag_node_operation.py b/python/ray/dag/dag_node_operation.py index d54333e536af..da6ca68dc778 100644 --- a/python/ray/dag/dag_node_operation.py +++ b/python/ray/dag/dag_node_operation.py @@ -223,16 +223,9 @@ def viz_str(self): """ A string representation of the node to be used in visualization. """ - class_name = ( - self.actor_handle._ray_actor_creation_function_descriptor.class_name - ) - actor_id_abbv = self._actor_id[:4] + "..." return ( - class_name - + "_" - + actor_id_abbv - + f" [{self.operation.exec_task_idx}] " - + f"{self.operation.method_name} {self.operation.type.viz_str()}" + f"[{self.operation.exec_task_idx}] " + f"{self.operation.method_name} {self.operation.type.viz_str()}" ) @property @@ -469,6 +462,18 @@ def _build_dag_node_operation_graph( return graph +def _actor_viz_str(actor: "ray.actor.ActorHandle"): + """ + A string representation of an actor in the visualization of the execution schedule. + + Args: + actor: The actor to be represented. + """ + class_name = actor._ray_actor_creation_function_descriptor.class_name + actor_id = actor._ray_actor_id.hex() + return f"Actor class name: {class_name}\nActor ID: {actor_id}" + + def _node_viz_str(node: _DAGOperationGraphNode, idx: int, optimized_index: int): """ A string representation of a node in the visualization of the execution schedule. @@ -497,10 +502,9 @@ def _visualize_execution_schedule( Details of the visualization: # noqa Node description format: - _ [] , + [] , Node description fields: - actor_id: is abbreviated, only the first 4 characters are shown operation: is R(READ), C(COMPUTE), or W(WRITE) orig_index: the index in the original execution schedule overlap_index: the index in the overlap-communication optimized execution schedule @@ -508,6 +512,7 @@ def _visualize_execution_schedule( Node grouping: The nodes belonging to the same actor are grouped in the same rectangle + The actor class name and the actor id are shown in the rectangle Edges: black color (without label): data dependency @@ -548,7 +553,9 @@ def _visualize_execution_schedule( } with dot.subgraph(name=f"cluster_{execution_nodes[0]._actor_id}") as subgraph: - subgraph.attr(rank=execution_nodes[0]._actor_id) + subgraph.attr( + rank=execution_nodes[0]._actor_id, label=_actor_viz_str(actor) + ) for i, node in enumerate(execution_nodes): optimized_index = node_to_optimized_index.get(node) node_viz = _node_viz_str(node, i, optimized_index) @@ -573,21 +580,21 @@ def _visualize_execution_schedule( legend.attr(label="Legend", labelloc="t", fontsize="20", bgcolor="lightgrey") # Single node and its explanation - legend.node("example_node", "Worker_3c6a... [0] bwd C 10,10\n") + legend.node("example_node", "[0] bwd C 10,10\n") explanation = ( '<' # noqa '' - '' # noqa + '' # noqa "" '' - '' # noqa '' # noqa '' # noqa '' # noqa '' # noqa "" '' - '' # noqa + '' # noqa + '' # noqa "" '' '' # noqa
Node description format:
<actor_name>_<actor_id> [<task_index>] <method_name> <operation> <orig_index>, <overlap_index>
[<task_index>] <method_name> <operation> <orig_index>, <overlap_index>
Node description fields:
actor_id: is abbreviated, only the first 4 characters are shown
operation: is R(READ), C(COMPUTE), or W(WRITE)
orig_index: the index in the original execution schedule
overlap_index: the index in the overlap-communication optimized execution schedule
If this is different from orig_index, the node is highlighted in red color
Node grouping:
The nodes belonging to the same actor are grouped in the same rectangular
The nodes belonging to the same actor are grouped in the same rectangle
The actor class name and the actor id are shown in the rectangle
Edges:
black color (without label): data dependency