Bug 1474 - clarifier la configuration électrique du rack3
From now on, the servers power diagram is available on http://intranet.ipr.univ-rennes1.fr/simpaweb/itteam/PowerDiagram/ - note : I initially thought I would use the jit (JavaScript InfoVis Toolkit) to display sexy interactive diagrams but I finally decided not to (although I managed to run an example) because: - svg is more printer-friendly, and could be saved as a file - generating jit data would have required more work, which doesn't add much value So, in a further commit, I will clean up the jit-related mess
This commit is contained in:
parent
8770bd488a
commit
95e3f4a3ed
|
@ -14,6 +14,7 @@ import re
|
|||
import sys
|
||||
import pygraphviz
|
||||
|
||||
|
||||
def add_capacity_constraints(capacity1, capacity2):
|
||||
"""
|
||||
combines 2 capacity constraints (max amperes) together
|
||||
|
@ -112,7 +113,7 @@ class Machine(object):
|
|||
power_consumption = self.power_consumption
|
||||
for conn in self.get_outgoing_connections():
|
||||
power_consumption += conn.get_power_consumption()
|
||||
print("machine %s : power_consumption += %f" % (self.name, conn.get_power_consumption()))
|
||||
# print("machine %s : power_consumption += %f" % (self.name, conn.get_power_consumption()))
|
||||
return power_consumption
|
||||
|
||||
|
||||
|
@ -242,15 +243,16 @@ class PowerConfig(object):
|
|||
rows = cur.fetchall()
|
||||
if len(rows) > 0:
|
||||
plug_type = rows[0][0]
|
||||
print('plug_type : %s' % plug_type)
|
||||
# print('plug_type : %s' % plug_type)
|
||||
|
||||
plug_capacity = get_plug_type_attr(cur, plug_type, 'max_amps')
|
||||
if plug_capacity:
|
||||
print('plug_capacity : %f A' % plug_capacity)
|
||||
#if plug_capacity:
|
||||
# print('plug_capacity : %f A' % plug_capacity)
|
||||
return plug_capacity
|
||||
|
||||
|
||||
sqliteDbPath='./simpa.db'
|
||||
sqliteDbPath=':memory:' # sqlite-specific special name for a file stored in memory. We could use something like '/tmp/simpadb.sqlite' here but this would make parsing really slow (1 minute instead of 1s), unless either :
|
||||
# - proper fix : group of INSERT statements are surrounded by BEGIN and COMMIT (see http://stackoverflow.com/questions/4719836/python-and-sqlite3-adding-thousands-of-rows)
|
||||
# - the file is stored on a solid state disk
|
||||
try:
|
||||
os.remove(sqliteDbPath)
|
||||
except:
|
||||
|
@ -293,7 +295,7 @@ class PowerConfig(object):
|
|||
if re.match('simpatix.._..', machine_name):
|
||||
machine_name = '_'.join(machine_name.split('_')[0:-1])
|
||||
|
||||
print(machine_name)
|
||||
# print(machine_name)
|
||||
|
||||
machine_spec_id = machine_name_toMachine_spec_id(cur, machine_name)
|
||||
if machine_spec_id is not None:
|
||||
|
@ -364,7 +366,7 @@ def power_config_to_svg( power_config, svg_file_path ):
|
|||
#graph.add_edge(u'a',u'b',color='blue')
|
||||
#graph.add_edge(u'b',u'a',color='blue')
|
||||
for con in power_config.connections:
|
||||
print(con.from_plug.machine.name, con.to_plug.machine.name)
|
||||
# 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()
|
||||
amperes = power_consumption/220.0
|
||||
|
|
Loading…
Reference in New Issue