now powermap draws redundant cables as dash lines.
fixes - Bug 4250 - incohérence des consommations affichées par powermap
This commit is contained in:
parent
8a2c46c377
commit
a8b477978d
|
|
@ -501,25 +501,29 @@ def power_config_to_svg(power_config: PowerConfig, svg_file_path: Path, worst_ca
|
|||
|
||||
for con in power_config.connections:
|
||||
# print(con.from_plug.machine.name, con.to_plug.machine.name)
|
||||
if not con.is_redundancy_cable(): # don't display redundancy cables, as they might overlap and hide the main one
|
||||
power_consumption = con.get_power_consumption(worst_case_scenario=worst_case_scenario)
|
||||
amperes = power_consumption / 220.0
|
||||
color = '/svg/green'
|
||||
capacity = con.get_max_amperes()
|
||||
penwidth_scaler = 0.25
|
||||
if capacity is None:
|
||||
max_amp = '? A'
|
||||
color = '/svg/red'
|
||||
penwidth = 100.0 * penwidth_scaler # make the problem clearly visible
|
||||
else:
|
||||
max_amp = str(capacity) + 'A'
|
||||
color = cable_colorer.get_cable_color(con, worst_case_scenario=worst_case_scenario)
|
||||
penwidth = capacity * penwidth_scaler
|
||||
label = "%.1f/%s" % (amperes, max_amp)
|
||||
# color='//%d' % int(9.0-amperes/capacity*8)
|
||||
power_consumption = con.get_power_consumption(worst_case_scenario=worst_case_scenario)
|
||||
amperes = power_consumption / 220.0
|
||||
color = '/svg/green'
|
||||
capacity = con.get_max_amperes()
|
||||
penwidth_scaler = 0.25
|
||||
if capacity is None:
|
||||
max_amp = '? A'
|
||||
color = '/svg/red'
|
||||
penwidth = 100.0 * penwidth_scaler # make the problem clearly visible
|
||||
else:
|
||||
max_amp = str(capacity) + 'A'
|
||||
color = cable_colorer.get_cable_color(con, worst_case_scenario=worst_case_scenario)
|
||||
penwidth = capacity * penwidth_scaler
|
||||
label = "%.1f/%s" % (amperes, max_amp)
|
||||
# color='//%d' % int(9.0-amperes/capacity*8)
|
||||
|
||||
# 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)
|
||||
if con.is_redundancy_cable():
|
||||
edge_style = 'dashed'
|
||||
else:
|
||||
edge_style = 'solid'
|
||||
|
||||
# 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, style=edge_style)
|
||||
|
||||
for rack_id, rack in racks.items():
|
||||
# sub = graph.add_subgraph(rack, name='cluster_%s' % rack_id, rank='same')
|
||||
|
|
@ -534,3 +538,4 @@ def power_config_to_svg(power_config: PowerConfig, svg_file_path: Path, worst_ca
|
|||
|
||||
graph.layout(prog='dot')
|
||||
graph.draw(svg_file_path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue