Prepare orchestration plan based on precedence scheduling

Use transitive reduction for graph output, to reduce number
of edges, and keep graph clean
This commit is contained in:
Dmitry Shulyak 2015-07-15 11:49:44 +03:00
parent 7e7b46614c
commit ce4fd8c8de
2 changed files with 8 additions and 4 deletions

View File

@ -105,8 +105,11 @@ def dg(uid):
for n in plan:
color = colors[plan.node[n]['status']]
plan.node[n]['color'] = color
nx.write_dot(plan, 'graph.dot')
subprocess.call(['dot', '-Tpng', 'graph.dot', '-o', 'graph.png'])
nx.write_dot(plan, '{name}.dot'.format(name=plan.graph['name']))
subprocess.call(
'tred {name}.dot | dot -Tpng -o {name}.png'.format(name=plan.graph['name']),
shell=True)
click.echo('Created {name}.png'.format(name=plan.graph['name']))
@orchestration.command()

View File

@ -82,7 +82,7 @@ def stage_changes():
return _stage_changes(staged, conn_graph, commited, log)
def send_to_orchestration(execute=False):
def send_to_orchestration():
conn_graph = signals.detailed_connection_graph()
dg = nx.DiGraph()
staged = {r.name: r.args_show()
@ -100,8 +100,9 @@ def send_to_orchestration(execute=False):
res_uid, status='PENDING',
errmsg=None,
**parameters(res_uid, guess_action(commited_data, staged_data)))
for pred in conn_graph.predecessors(res_uid):
dg.add_edge(pred, res_uid)
dg.add_path(nx.topological_sort(conn_graph))
# what it should be?
dg.graph['name'] = 'system_log'
return graph.create_plan_from_graph(dg)