Ejemplo n.º 1
0
 def __init__(self, **kwargs):
     if kwargs:
         self.cpu_cores = kwargs['cpu_cores']
         self.os_type = kwargs['os_type']
         self.memory_mb = kwargs['memory_mb']
         self.architecture = kwargs['architecture']
         self.load_average = kwargs['load_average']
         self.disk_usage = kwargs['disk_usage']
     else:
         self.cpu_cores = sys_assist.get_cpu_core_count()
         self.os_type = platform.platform()
         self.memory_mb = sys_assist.get_sys_mem_total_MB()
         self.architecture = platform.machine()
         self.load_average = sys_assist.get_load_average()
         self.disk_usage = sys_assist.get_disk_usage()
Ejemplo n.º 2
0
 def __init__(self, **kwargs):
     if kwargs:
         self.cpu_cores = kwargs['cpu_cores']
         self.os_type = kwargs['os_type']
         self.memory_mb = kwargs['memory_mb']
         self.architecture = kwargs['architecture']
         self.load_average = kwargs['load_average']
         self.disk_usage = kwargs['disk_usage']
         self.timestamp = kwargs['timestamp']
     else:
         self.cpu_cores = sys_assist.get_cpu_core_count()
         self.os_type = platform.platform()
         self.memory_mb = sys_assist.get_sys_mem_total_MB()
         self.architecture = platform.machine()
         self.load_average = sys_assist.get_load_average()
         self.disk_usage = sys_assist.get_disk_usage()
         self.timestamp = timeutils.utcnow()
Ejemplo n.º 3
0
 def __init__(self, **kwargs):
     """
     An object can be initialized by passing in a dictionary representation
     of the data as **kwargs.  Otherwise the constructor will retrieve
     system stats from the machine it is executing on.
     """
     if kwargs:
         self.cpu_cores = kwargs['cpu_cores']
         self.os_type = kwargs['os_type']
         self.memory_mb = kwargs['memory_mb']
         self.architecture = kwargs['architecture']
         self.load_average = kwargs['load_average']
         self.disk_usage = kwargs['disk_usage']
         self.timestamp = kwargs['timestamp']
     else:
         self.cpu_cores = sys_assist.get_cpu_core_count()
         self.os_type = platform.platform()
         self.memory_mb = sys_assist.get_sys_mem_total_MB()
         self.architecture = platform.machine()
         self.load_average = sys_assist.get_load_average()
         self.disk_usage = sys_assist.get_disk_usage()
         self.timestamp = str(timeutils.utcnow())
Ejemplo n.º 4
0
 def __init__(self, **kwargs):
     """
     An object can be initialized by passing in a dictionary representation
     of the data as **kwargs.  Otherwise the constructor will retrieve
     system stats from the machine it is executing on.
     """
     if kwargs:
         self.cpu_cores = kwargs['cpu_cores']
         self.os_type = kwargs['os_type']
         self.memory_mb = kwargs['memory_mb']
         self.architecture = kwargs['architecture']
         self.load_average = kwargs['load_average']
         self.disk_usage = kwargs['disk_usage']
         self.timestamp = kwargs['timestamp']
     else:
         self.cpu_cores = sys_assist.get_cpu_core_count()
         self.os_type = platform.platform()
         self.memory_mb = sys_assist.get_sys_mem_total_MB()
         self.architecture = platform.machine()
         self.load_average = sys_assist.get_load_average()
         self.disk_usage = sys_assist.get_disk_usage()
         self.timestamp = timeutils.utcnow()
Ejemplo n.º 5
0
 def test_get_sys_mem_total_MB_should_return_4098(self):
     with patch.object(sys_assist.sys, 'platform', self.platform), \
             patch.object(__builtin__, 'open', return_value=self.meminfo):
         mem_total = sys_assist.get_sys_mem_total_MB()
         self.assertEqual(mem_total, 4098)
Ejemplo n.º 6
0
 def test_get_sys_mem_total_MB_should_return_4098(self):
     with patch.object(sys_assist.sys, 'platform', self.platform), \
             patch.object(__builtin__, 'open', return_value=self.meminfo):
         mem_total = sys_assist.get_sys_mem_total_MB()
         self.assertEqual(mem_total, 4098)