def plotPipelineInstance(self):
'''
Plot current instance of pipeline stages with metadata
@return iPython display object
'''
#Graph setup
g1 = gv.Digraph(format='svg')
g1.graph_attr['rankdir'] = 'LR'
g1.node_attr['shape'] = 'rounded'
g1.node_attr['fontname'] = 'Arial'
g1.node_attr['fontsize'] = '9'
g1.node_attr['style'] = 'filled'
g1.node_attr['margin'] = '0.1'
g1.node_attr['height'] = '0.1'
g1.node_attr['fillcolor'] = '#d8e9fd'
#g1.node_attr['shape'] = 'plaintext' #use this to remove boxes around nodes
# Some stagecontainers directly return the metadata as string,
# others return a list of strings for each item in the stage
# container.
metadata_list = []
for s in self.stage_containers:
first_metadata = s.getMetadata()
if isinstance(first_metadata, str):
metadata_list.append(first_metadata)
else:
for second_metadata in first_metadata:
metadata_list.append(second_metadata)
nodelist = [re.sub('\:',';', metadata) for metadata in metadata_list]
for s in nodelist:
g1.node(s)
g1.edges(zip(nodelist, nodelist[1:]))
g1.render('img/plotPipelineInstance')
#print(g1.source)
#return display(Image('img/pipelinePlot.svg'))
return display(SVG('img/plotPipelineInstance.svg'))
评论列表
文章目录