Skip to content

Commit 1a3b5f3

Browse files
author
Yi-Ting Lee
committed
info on hover
1 parent ff136c1 commit 1a3b5f3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sagemaker/lineage/query.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
from datetime import datetime
1717
from enum import Enum
18+
from platform import node
1819
from typing import Optional, Union, List, Dict
20+
import re
1921

2022
from sagemaker.lineage._utils import get_resource_name_from_arn, get_module
2123

@@ -330,12 +332,14 @@ def render(self, elements, path="pyvisExample.html"):
330332

331333
# add nodes to graph
332334
for arn, source, entity, is_start_arn in elements["nodes"]:
335+
source = re.sub(r"(\w)([A-Z])", r"\1 \2", source)
336+
node_info = "Entity: " + entity + "\n" + "Type: " + source + "\n" + "Name: " + arn
333337
if is_start_arn: # startarn
334338
net.add_node(
335-
arn, label=source, title=entity+"\n"+arn, color=self._node_color(entity), shape="star", borderWidth=3
339+
arn, label=source, title=node_info, color=self._node_color(entity), shape="star", borderWidth=3
336340
)
337341
else:
338-
net.add_node(arn, label=source, title=entity+"\n"+arn, color=self._node_color(entity), borderWidth=3)
342+
net.add_node(arn, label=source, title=node_info, color=self._node_color(entity), borderWidth=3)
339343

340344
# add edges to graph
341345
for src, dest, asso_type in elements["edges"]:
@@ -391,7 +395,7 @@ def __str__(self):
391395
392396
"""
393397
return (
394-
"{\n"
398+
"{"
395399
+ "\n\n".join("'{}': {},".format(key, val) for key, val in self.__dict__.items())
396400
+ "\n}"
397401
)

0 commit comments

Comments
 (0)