cocluto v1.08
- fixed bug that caused `draw_machine_age_pyramid_graph` to fail when some cluster machines get older than 20 years. Increased the age limit to 25 years, and added clipping to the graph to cope with some machines even older than this fixes [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=4101]
This commit is contained in:
parent
8679ae2ca5
commit
8a2c46c377
|
@ -315,7 +315,7 @@ def draw_machine_age_pyramid_graph(inventory):
|
|||
:param Inventory inventory: the inventory database
|
||||
"""
|
||||
|
||||
oldest_age = 20
|
||||
oldest_age = 25
|
||||
age_histogram = np.zeros(shape=(oldest_age))
|
||||
|
||||
rows = inventory.query("SELECT * FROM machines")
|
||||
|
@ -328,7 +328,9 @@ def draw_machine_age_pyramid_graph(inventory):
|
|||
if purchase_date is not None:
|
||||
purchase_time = matplotlib.dates.date2num(purchase_date.date()) # noqa: F841
|
||||
age = datetime.datetime.now() - purchase_date
|
||||
age_histogram[age.days // 365] += 1
|
||||
age_in_years = age.days // 365
|
||||
if age_in_years < oldest_age:
|
||||
age_histogram[age_in_years] += 1
|
||||
# print(name, age)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
@ -349,7 +351,7 @@ def draw_core_age_pyramid_graph(inventory):
|
|||
:param Inventory inventory: the inventory database
|
||||
"""
|
||||
|
||||
oldest_age = 20
|
||||
oldest_age = 25
|
||||
age_histogram = np.zeros(shape=(oldest_age))
|
||||
|
||||
rows = inventory.query("SELECT * FROM machines")
|
||||
|
@ -362,7 +364,9 @@ def draw_core_age_pyramid_graph(inventory):
|
|||
if purchase_date is not None:
|
||||
purchase_time = matplotlib.dates.date2num(purchase_date.date()) # noqa: F841
|
||||
age = datetime.datetime.now() - purchase_date
|
||||
age_histogram[age.days // 365] += inventory.get_num_cores(name)
|
||||
age_in_years = age.days // 365
|
||||
if age_in_years < oldest_age:
|
||||
age_histogram[age_in_years] += inventory.get_num_cores(name)
|
||||
# print(name, age)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
|
Loading…
Reference in New Issue