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:
parent
7e7b46614c
commit
ce4fd8c8de
@ -105,8 +105,11 @@ def dg(uid):
|
|||||||
for n in plan:
|
for n in plan:
|
||||||
color = colors[plan.node[n]['status']]
|
color = colors[plan.node[n]['status']]
|
||||||
plan.node[n]['color'] = color
|
plan.node[n]['color'] = color
|
||||||
nx.write_dot(plan, 'graph.dot')
|
nx.write_dot(plan, '{name}.dot'.format(name=plan.graph['name']))
|
||||||
subprocess.call(['dot', '-Tpng', 'graph.dot', '-o', 'graph.png'])
|
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()
|
@orchestration.command()
|
||||||
|
@ -82,7 +82,7 @@ def stage_changes():
|
|||||||
return _stage_changes(staged, conn_graph, commited, log)
|
return _stage_changes(staged, conn_graph, commited, log)
|
||||||
|
|
||||||
|
|
||||||
def send_to_orchestration(execute=False):
|
def send_to_orchestration():
|
||||||
conn_graph = signals.detailed_connection_graph()
|
conn_graph = signals.detailed_connection_graph()
|
||||||
dg = nx.DiGraph()
|
dg = nx.DiGraph()
|
||||||
staged = {r.name: r.args_show()
|
staged = {r.name: r.args_show()
|
||||||
@ -100,8 +100,9 @@ def send_to_orchestration(execute=False):
|
|||||||
res_uid, status='PENDING',
|
res_uid, status='PENDING',
|
||||||
errmsg=None,
|
errmsg=None,
|
||||||
**parameters(res_uid, guess_action(commited_data, staged_data)))
|
**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?
|
# what it should be?
|
||||||
dg.graph['name'] = 'system_log'
|
dg.graph['name'] = 'system_log'
|
||||||
return graph.create_plan_from_graph(dg)
|
return graph.create_plan_from_graph(dg)
|
||||||
|
Loading…
Reference in New Issue
Block a user