[cli] inspect is buggy if there is more than one node with a given name.

This commit is contained in:
Romain Dorgueil
2017-10-03 23:26:31 +02:00
parent 75a68d1322
commit a830263efc

View File

@ -6,6 +6,8 @@ from bonobo.util.objects import get_name
OUTPUT_GRAPHVIZ = 'graphviz' OUTPUT_GRAPHVIZ = 'graphviz'
def _ident(graph, i):
return json.dumps(get_name(graph[i])+' ('+str(i)+')')
def execute(*, output, **kwargs): def execute(*, output, **kwargs):
graph, plugins, services = read(**kwargs) graph, plugins, services = read(**kwargs)
@ -16,11 +18,11 @@ def execute(*, output, **kwargs):
print(' "BEGIN" [shape="point"];') print(' "BEGIN" [shape="point"];')
for i in graph.outputs_of(BEGIN): for i in graph.outputs_of(BEGIN):
print(' "BEGIN" -> ' + json.dumps(get_name(graph[i])) + ';') print(' "BEGIN" -> ' + _ident(graph, i) + ';')
for ix in graph.topologically_sorted_indexes: for ix in graph.topologically_sorted_indexes:
for iy in graph.outputs_of(ix): for iy in graph.outputs_of(ix):
print(' {} -> {};'.format(json.dumps(get_name(graph[ix])), json.dumps(get_name(graph[iy])))) print(' {} -> {};'.format(_ident(graph, ix), _ident(graph, iy)))
print('}') print('}')
else: else: