Пример #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()
Пример #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()
Пример #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())
Пример #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()
Пример #5
0
 def test_get_cpu_core_count_should_return_4(self):
     with patch.object(sys_assist.multiprocessing, 'cpu_count',
                       return_value=4):
         cpu_count = sys_assist.get_cpu_core_count()
         self.assertEqual(cpu_count, 4)
Пример #6
0
 def test_get_cpu_core_count_should_return_4(self):
     with patch.object(sys_assist.multiprocessing, 'cpu_count',
                       return_value=4):
         cpu_count = sys_assist.get_cpu_core_count()
         self.assertEqual(cpu_count, 4)