This commit is contained in:
Guillaume Raffy 2019-06-27 09:26:25 +00:00
parent ac76f82b67
commit 13d52fd4d4
1 changed files with 6 additions and 12 deletions

View File

@ -474,18 +474,12 @@ def power_config_to_svg(power_config, svg_file_path, worst_case_scenario=True):
# graph.add_edge(con.from_plug.machine.name, con.to_plug.machine.name, color="%s:%s" % (color, wsc_color), label=label, penwidth="%s:%s" % (penwidth, penwidth)) # graph.add_edge(con.from_plug.machine.name, con.to_plug.machine.name, color="%s:%s" % (color, wsc_color), label=label, penwidth="%s:%s" % (penwidth, penwidth))
graph.add_edge(con.from_plug.machine.name, con.to_plug.machine.name, color=color, label=label, penwidth=penwidth) graph.add_edge(con.from_plug.machine.name, con.to_plug.machine.name, color=color, label=label, penwidth=penwidth)
if False: # len(con.from_plug.machine.input_plugs) == 0: for rack_id, rack in racks.iteritems():
ultimate_power_provider_node = graph.get_node(con.from_plug.machine.name) # sub = graph.add_subgraph(rack, name='cluster_%s' % rack_id, rank='same')
total_power_consumption = int(con.from_plug.machine.get_power_consumption(worst_case_scenario=worst_case_scenario)) machine_names = list(machine.name for machine in rack['machines'])
ultimate_power_provider_node.attr['label']='%s (%d W)' % (con.from_plug.machine.name, total_power_consumption) sub = graph.add_subgraph(machine_names, name='cluster_%s' % rack_id, style='rounded')
sub.graph_attr['label'] = rack_id
if True: # sub.graph_attr['rank']='same'
for rack_id, rack in racks.iteritems():
# sub = graph.add_subgraph(rack, name='cluster_%s' % rack_id, rank='same')
machine_names = list(machine.name for machine in rack['machines'])
sub = graph.add_subgraph(machine_names, name='cluster_%s' % rack_id, style='rounded')
sub.graph_attr['label'] = rack_id
# sub.graph_attr['rank']='same'
# assert False # assert False
#graph.layout(prog='twopi') #graph.layout(prog='twopi')
with open('./toto.dot', 'w') as f: with open('./toto.dot', 'w') as f: