Skip to content

Commit

Permalink
Merge pull request #194 from fabric-testbed/rel1.6
Browse files Browse the repository at this point in the history
Rel 1.6
  • Loading branch information
kthare10 authored Feb 9, 2024
2 parents c58caee + 52d5746 commit 2be7b3a
Show file tree
Hide file tree
Showing 9 changed files with 667 additions and 514 deletions.
2 changes: 1 addition & 1 deletion fim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
FABRIC Information Model library and utilities
"""
__VERSION__ = "1.5.5"
__VERSION__ = "1.6.1"
__version__ = __VERSION__
13 changes: 11 additions & 2 deletions fim/logging/log_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"""

from typing import Dict, Any, List
from collections import defaultdict

from fim.user.topology import ExperimentTopology
from fim.user.node import Node
Expand Down Expand Up @@ -187,7 +188,7 @@ def __str__(self):
comp = ' compute ' + ','.join(['vms:' + str(self._attributes['vm_count']),
'cores:' + str(self._attributes['core_count']),
'p4s:' + str(self._attributes['p4_count'])])
sites = facilities = components = services = ''
sites = facilities = components = services = vmdetails = ''

if len(self._attributes['sites']):
sites = ' sites ' + ','.join(self._attributes['sites'])
Expand All @@ -204,7 +205,15 @@ def __str__(self):
slist = [t[0] + ':' + str(t[1]) for t in filter(lambda n: n[0] != 'OVS', self._attributes['services'])]
services = ' services ' + ','.join(slist)

return ';'.join(filter(lambda n: len(n) > 0, [comp, sites, facilities, components, services]))
# aggregate VM capacity information
if len(self._attributes['nodes']) > 0:
vmdict = defaultdict(int)
for cap in self._attributes['nodes']:
# these are capacity_allocation or capacity objects (if capacity_allocation is set it is preferred)
vmdict[f'C{cap.core}/R{cap.ram}/D{cap.disk}'] += 1
vmdetails = ' vmdetails ' + ','.join([i[0] + ':' + str(i[1]) for i in vmdict.items()])

return ';'.join(filter(lambda n: len(n) > 0, [comp, sites, facilities, components, services, vmdetails]))

def __repr__(self):
return str(self.attributes)
Expand Down
Loading

0 comments on commit 2be7b3a

Please sign in to comment.