sciveo 0.0.45__tar.gz → 0.0.47__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sciveo-0.0.45 → sciveo-0.0.47}/PKG-INFO +1 -1
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/hardware.py +10 -4
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/monitoring/monitor.py +46 -12
- sciveo-0.0.47/sciveo/version.py +2 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo.egg-info/PKG-INFO +1 -1
- sciveo-0.0.45/sciveo/version.py +0 -2
- {sciveo-0.0.45 → sciveo-0.0.47}/README.md +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/api/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/api/base.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/api/upload.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/configuration.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/model.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/optimizers.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/sampling.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/daemon.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/formating.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/logger.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/common/tools/synchronized.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/content/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/content/dataset.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/content/experiment.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/content/project.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/content/runner.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/monitoring/__init__.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo/monitoring/start.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo.egg-info/SOURCES.txt +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo.egg-info/dependency_links.txt +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo.egg-info/requires.txt +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/sciveo.egg-info/top_level.txt +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/setup.cfg +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/setup.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/test/test_configuration.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/test/test_monitoring.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/test/test_runner.py +0 -0
- {sciveo-0.0.45 → sciveo-0.0.47}/test/test_sampling.py +0 -0
|
@@ -32,19 +32,25 @@ def new_guid(num_characters=32):
|
|
|
32
32
|
|
|
33
33
|
class HardwareInfo:
|
|
34
34
|
def __init__(self):
|
|
35
|
-
self.data = {
|
|
36
|
-
"CPU": {"count": os.cpu_count()},
|
|
37
|
-
"RAM": format_memory_size(os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES'))
|
|
38
|
-
}
|
|
35
|
+
self.data = {}
|
|
39
36
|
|
|
40
37
|
self.get_cpu()
|
|
38
|
+
self.get_ram()
|
|
41
39
|
|
|
42
40
|
def __call__(self):
|
|
43
41
|
return self.data
|
|
44
42
|
|
|
43
|
+
def get_ram(self):
|
|
44
|
+
try:
|
|
45
|
+
self.data["RAM"] = format_memory_size(os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES'))
|
|
46
|
+
except Exception:
|
|
47
|
+
pass
|
|
48
|
+
|
|
45
49
|
def get_cpu(self):
|
|
46
50
|
list_keys = ["model name", "stepping", "cpu MHz", "cache size", "siblings", "cpu cores", "bogomips"]
|
|
47
51
|
try:
|
|
52
|
+
self.data["CPU"] = {"count": os.cpu_count()}
|
|
53
|
+
|
|
48
54
|
cpu_info = {}
|
|
49
55
|
with open('/proc/cpuinfo', 'r') as file:
|
|
50
56
|
lines = file.readlines()
|
|
@@ -31,17 +31,19 @@ class BaseMonitor(DaemonBase):
|
|
|
31
31
|
|
|
32
32
|
self.data = HardwareInfo()()
|
|
33
33
|
self.data.setdefault("CPU", {})
|
|
34
|
-
self.data
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
self.data.setdefault("DISK", {})
|
|
35
|
+
self.data.setdefault("NET", {})
|
|
36
|
+
self.data["RAM"] = {}
|
|
37
37
|
self.data["LOG"] = {}
|
|
38
38
|
self.list_logs = []
|
|
39
39
|
|
|
40
40
|
self.api = APIRemoteClient()
|
|
41
41
|
|
|
42
|
-
# Warmup the psutil
|
|
42
|
+
# Warmup the psutil
|
|
43
43
|
psutil.cpu_percent(interval=0.3, percpu=True)
|
|
44
44
|
initial_cpu_usage = psutil.cpu_percent(interval=None, percpu=True)
|
|
45
|
+
self.previous_disk_io_counters = psutil.disk_io_counters(perdisk=False)
|
|
46
|
+
self.previous_net_io_counters = psutil.net_io_counters(pernic=False)
|
|
45
47
|
time.sleep(1)
|
|
46
48
|
|
|
47
49
|
machine_serial = self.getserial()
|
|
@@ -55,6 +57,8 @@ class BaseMonitor(DaemonBase):
|
|
|
55
57
|
self.get_cpu_usage()
|
|
56
58
|
self.get_memory()
|
|
57
59
|
self.get_gpu()
|
|
60
|
+
self.get_disk()
|
|
61
|
+
self.get_network()
|
|
58
62
|
|
|
59
63
|
self.tail_logs()
|
|
60
64
|
self.data["local_time"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -68,16 +72,23 @@ class BaseMonitor(DaemonBase):
|
|
|
68
72
|
self.data["LOG"][log_name] = self.tail_file(log_path)[-3:]
|
|
69
73
|
|
|
70
74
|
def get_cpu_usage(self):
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
try:
|
|
76
|
+
usage_per_core = psutil.cpu_percent(interval=None, percpu=True)
|
|
77
|
+
self.data["CPU"]["usage per core"] = usage_per_core
|
|
78
|
+
self.data["CPU"]["usage"] = np.array(usage_per_core).mean()
|
|
79
|
+
except Exception:
|
|
80
|
+
pass
|
|
74
81
|
|
|
75
82
|
def get_memory(self):
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
try:
|
|
84
|
+
memory = psutil.virtual_memory()
|
|
85
|
+
self.data["RAM"]["used"] = memory.used
|
|
86
|
+
self.data["RAM"]["total"] = memory.total
|
|
87
|
+
self.data["RAM"]["free"] = memory.free
|
|
88
|
+
# self.data["RAM"]["installed"] = format_memory_size(memory.total)
|
|
89
|
+
self.data["RAM"]["print"] = f"total: {format_memory_size(memory.total)} used: {format_memory_size(memory.used)}"
|
|
90
|
+
except Exception:
|
|
91
|
+
pass
|
|
81
92
|
|
|
82
93
|
def getserial(self):
|
|
83
94
|
machine_serial = None
|
|
@@ -124,7 +135,30 @@ class BaseMonitor(DaemonBase):
|
|
|
124
135
|
except Exception as e:
|
|
125
136
|
pass
|
|
126
137
|
|
|
138
|
+
def get_disk(self):
|
|
139
|
+
try:
|
|
140
|
+
list_metrics = ["read count", "write count", "read bytes", "write bytes", "read time", "write time"]
|
|
141
|
+
disk_io_counters = psutil.disk_io_counters(perdisk=False)
|
|
142
|
+
self.get_io_metrics("DISK", list_metrics, disk_io_counters, self.previous_disk_io_counters)
|
|
143
|
+
self.previous_disk_io_counters = disk_io_counters
|
|
144
|
+
except Exception as e:
|
|
145
|
+
pass
|
|
146
|
+
|
|
147
|
+
def get_network(self):
|
|
148
|
+
try:
|
|
149
|
+
list_metrics = ["bytes sent", "bytes recv", "packets sent", "packets recv"]
|
|
150
|
+
net_io_counters = psutil.net_io_counters(pernic=False)
|
|
151
|
+
self.get_io_metrics("NET", list_metrics, net_io_counters, self.previous_net_io_counters)
|
|
152
|
+
self.previous_net_io_counters = net_io_counters
|
|
153
|
+
except Exception as e:
|
|
154
|
+
pass
|
|
127
155
|
|
|
156
|
+
def get_io_metrics(self, name, list_metrics, io_counters, prev_io_counters):
|
|
157
|
+
counters = io_counters._asdict()
|
|
158
|
+
prev_io_counters = prev_io_counters._asdict()
|
|
159
|
+
for metric_name in list_metrics:
|
|
160
|
+
metric_key = metric_name.replace(' ', '_')
|
|
161
|
+
self.data[name][metric_name] = counters[metric_key] - prev_io_counters[metric_key]
|
|
128
162
|
|
|
129
163
|
|
|
130
164
|
if __name__ == "__main__":
|
sciveo-0.0.45/sciveo/version.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|