@@ -99,7 +99,8 @@ def __str__(self):
99
99
100
100
Format:
101
101
{
102
- 'source_arn': 'string', 'destination_arn': 'string',
102
+ 'source_arn': 'string',
103
+ 'destination_arn': 'string',
103
104
'association_type': 'string'
104
105
}
105
106
@@ -111,7 +112,8 @@ def __repr__(self):
111
112
112
113
Format:
113
114
{
114
- 'source_arn': 'string', 'destination_arn': 'string',
115
+ 'source_arn': 'string',
116
+ 'destination_arn': 'string',
115
117
'association_type': 'string'
116
118
}
117
119
@@ -161,7 +163,8 @@ def __str__(self):
161
163
162
164
Format:
163
165
{
164
- 'arn': 'string', 'lineage_entity': 'string',
166
+ 'arn': 'string',
167
+ 'lineage_entity': 'string',
165
168
'lineage_source': 'string',
166
169
'_session': <sagemaker.session.Session object>
167
170
}
@@ -174,7 +177,8 @@ def __repr__(self):
174
177
175
178
Format:
176
179
{
177
- 'arn': 'string', 'lineage_entity': 'string',
180
+ 'arn': 'string',
181
+ 'lineage_entity': 'string',
178
182
'lineage_source': 'string',
179
183
'_session': <sagemaker.session.Session object>
180
184
}
@@ -238,7 +242,7 @@ def __init__(self, graph_styles):
238
242
graph_styles: A dictionary that contains graph style for node and edges by their type.
239
243
Example: Display the nodes with different color by their lineage entity / different
240
244
shape by start arn.
241
- lineage_graph = {
245
+ lineage_graph_styles = {
242
246
"TrialComponent": {
243
247
"name": "Trial Component",
244
248
"style": {"background-color": "#f6cf61"},
@@ -253,7 +257,7 @@ def __init__(self, graph_styles):
253
257
"name": "StartArn",
254
258
"style": {"shape": "star"},
255
259
"isShape": "True",
256
- "symbol": "★", # shape symbol for legend
260
+ "symbol": "★", # shape symbol for legend
257
261
},
258
262
}
259
263
@@ -297,7 +301,7 @@ def __init__(self, graph_styles):
297
301
"solver": "hierarchicalRepulsion"
298
302
}
299
303
}
300
- """
304
+ """
301
305
302
306
def _import_visual_modules (self ):
303
307
"""Import modules needed for visualization."""
@@ -358,7 +362,7 @@ def _add_legend(self, path):
358
362
with open (path , "w" , encoding = "utf8" ) as file :
359
363
file .write (html )
360
364
361
- def render (self , elements , path = "pyvisExample .html" ):
365
+ def render (self , elements , path = "lineage_graph_pyvis.html .html" ):
362
366
"""Render graph for lineage query result.
363
367
364
368
Args:
@@ -370,7 +374,7 @@ def render(self, elements, path="pyvisExample.html"):
370
374
elements["edges"] contains list of tuples, each tuple represents an edge
371
375
format: (edge source arn, edge destination arn, edge association type)
372
376
373
- path(optional): The path/filemname of the rendered graph html file. (default path: "pyvisExample .html")
377
+ path(optional): The path/filename of the rendered graph html file. (default path: "lineage_graph_pyvis.html .html")
374
378
375
379
Returns:
376
380
display graph: The interactive visualization is presented as a static HTML file.
@@ -457,13 +461,21 @@ def __str__(self):
457
461
Format:
458
462
{
459
463
'edges':[
460
- {'source_arn': 'string', 'destination_arn': 'string', 'association_type': 'string'},
461
- ...],
464
+ {
465
+ 'source_arn': 'string',
466
+ 'destination_arn': 'string',
467
+ 'association_type': 'string'
468
+ },
469
+ ],
462
470
463
471
'vertices':[
464
- {'arn': 'string', 'lineage_entity': 'string', 'lineage_source': 'string',
465
- '_session': <sagemaker.session.Session object>},
466
- ...],
472
+ {
473
+ 'arn': 'string',
474
+ 'lineage_entity': 'string',
475
+ 'lineage_source': 'string',
476
+ '_session': <sagemaker.session.Session object>
477
+ },
478
+ ],
467
479
468
480
'startarn':['string', ...]
469
481
}
@@ -503,7 +515,7 @@ def _get_visualization_elements(self):
503
515
elements = {"nodes" : verts , "edges" : edges }
504
516
return elements
505
517
506
- def visualize (self , path = "pyvisExample .html" ):
518
+ def visualize (self , path : Optional [ str ] = "lineage_graph_pyvis.html .html" ):
507
519
"""Visualize lineage query result.
508
520
509
521
Creates a PyvisVisualizer object to render network graph with Pyvis library.
@@ -512,12 +524,12 @@ def visualize(self, path="pyvisExample.html"):
512
524
PyvisVisualizer for rendering graph.
513
525
514
526
Args:
515
- path(optional): The path/filemname of the rendered graph html file. (default path: "pyvisExample .html")
527
+ path(optional): The path/filemname of the rendered graph html file. (default path: "lineage_graph_pyvis.html .html")
516
528
517
529
Returns:
518
530
display graph: The interactive visualization is presented as a static HTML file.
519
531
"""
520
- lineage_graph = {
532
+ lineage_graph_styles = {
521
533
# nodes can have shape / color
522
534
"TrialComponent" : {
523
535
"name" : "Trial Component" ,
@@ -547,7 +559,7 @@ def visualize(self, path="pyvisExample.html"):
547
559
},
548
560
}
549
561
550
- pyvis_vis = PyvisVisualizer (lineage_graph )
562
+ pyvis_vis = PyvisVisualizer (lineage_graph_styles )
551
563
elements = self ._get_visualization_elements ()
552
564
return pyvis_vis .render (elements = elements , path = path )
553
565
0 commit comments