sciveo 0.0.46__tar.gz → 0.0.48__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.
Files changed (38) hide show
  1. {sciveo-0.0.46 → sciveo-0.0.48}/PKG-INFO +1 -1
  2. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/monitoring/monitor.py +52 -10
  3. sciveo-0.0.48/sciveo/version.py +2 -0
  4. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo.egg-info/PKG-INFO +1 -1
  5. sciveo-0.0.46/sciveo/version.py +0 -2
  6. {sciveo-0.0.46 → sciveo-0.0.48}/README.md +0 -0
  7. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/__init__.py +0 -0
  8. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/api/__init__.py +0 -0
  9. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/api/base.py +0 -0
  10. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/api/upload.py +0 -0
  11. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/__init__.py +0 -0
  12. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/configuration.py +0 -0
  13. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/model.py +0 -0
  14. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/optimizers.py +0 -0
  15. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/sampling.py +0 -0
  16. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/__init__.py +0 -0
  17. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/daemon.py +0 -0
  18. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/formating.py +0 -0
  19. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/hardware.py +0 -0
  20. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/logger.py +0 -0
  21. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/common/tools/synchronized.py +0 -0
  22. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/content/__init__.py +0 -0
  23. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/content/dataset.py +0 -0
  24. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/content/experiment.py +0 -0
  25. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/content/project.py +0 -0
  26. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/content/runner.py +0 -0
  27. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/monitoring/__init__.py +0 -0
  28. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo/monitoring/start.py +0 -0
  29. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo.egg-info/SOURCES.txt +0 -0
  30. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo.egg-info/dependency_links.txt +0 -0
  31. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo.egg-info/requires.txt +0 -0
  32. {sciveo-0.0.46 → sciveo-0.0.48}/sciveo.egg-info/top_level.txt +0 -0
  33. {sciveo-0.0.46 → sciveo-0.0.48}/setup.cfg +0 -0
  34. {sciveo-0.0.46 → sciveo-0.0.48}/setup.py +0 -0
  35. {sciveo-0.0.46 → sciveo-0.0.48}/test/test_configuration.py +0 -0
  36. {sciveo-0.0.46 → sciveo-0.0.48}/test/test_monitoring.py +0 -0
  37. {sciveo-0.0.46 → sciveo-0.0.48}/test/test_runner.py +0 -0
  38. {sciveo-0.0.46 → sciveo-0.0.48}/test/test_sampling.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.46
3
+ Version: 0.0.48
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
 
@@ -31,15 +31,22 @@ class BaseMonitor(DaemonBase):
31
31
 
32
32
  self.data = HardwareInfo()()
33
33
  self.data.setdefault("CPU", {})
34
+ self.data.setdefault("DISK", {})
35
+ self.data.setdefault("NET", {})
34
36
  self.data["RAM"] = {}
35
37
  self.data["LOG"] = {}
36
38
  self.list_logs = []
37
39
 
38
40
  self.api = APIRemoteClient()
39
41
 
40
- # Warmup the psutil cpu usage
42
+ # Warmup the psutil
41
43
  psutil.cpu_percent(interval=0.3, percpu=True)
42
44
  initial_cpu_usage = psutil.cpu_percent(interval=None, percpu=True)
45
+ self.previous_io_counters = {
46
+ "DISK": psutil.disk_io_counters(perdisk=False),
47
+ "NET": psutil.net_io_counters(pernic=False)
48
+ }
49
+ self.previous_time = {"DISK": time.time(), "NET": time.time()}
43
50
  time.sleep(1)
44
51
 
45
52
  machine_serial = self.getserial()
@@ -53,6 +60,8 @@ class BaseMonitor(DaemonBase):
53
60
  self.get_cpu_usage()
54
61
  self.get_memory()
55
62
  self.get_gpu()
63
+ self.get_disk()
64
+ self.get_network()
56
65
 
57
66
  self.tail_logs()
58
67
  self.data["local_time"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -66,17 +75,23 @@ class BaseMonitor(DaemonBase):
66
75
  self.data["LOG"][log_name] = self.tail_file(log_path)[-3:]
67
76
 
68
77
  def get_cpu_usage(self):
69
- usage_per_core = psutil.cpu_percent(interval=None, percpu=True)
70
- self.data["CPU"]["usage per core"] = usage_per_core
71
- self.data["CPU"]["usage"] = np.array(usage_per_core).mean()
78
+ try:
79
+ usage_per_core = psutil.cpu_percent(interval=None, percpu=True)
80
+ self.data["CPU"]["usage per core"] = usage_per_core
81
+ self.data["CPU"]["usage"] = np.array(usage_per_core).mean()
82
+ except Exception:
83
+ pass
72
84
 
73
85
  def get_memory(self):
74
- memory = psutil.virtual_memory()
75
- self.data["RAM"]["used"] = memory.used
76
- self.data["RAM"]["total"] = memory.total
77
- self.data["RAM"]["free"] = memory.free
78
- self.data["RAM"]["installed"] = format_memory_size(memory.total)
79
- self.data["RAM"]["print"] = f"total: {format_memory_size(memory.total)} used: {format_memory_size(memory.used)}"
86
+ try:
87
+ memory = psutil.virtual_memory()
88
+ self.data["RAM"]["used"] = memory.used
89
+ self.data["RAM"]["total"] = memory.total
90
+ self.data["RAM"]["free"] = memory.free
91
+ # self.data["RAM"]["installed"] = format_memory_size(memory.total)
92
+ self.data["RAM"]["print"] = f"total: {format_memory_size(memory.total)} used: {format_memory_size(memory.used)}"
93
+ except Exception:
94
+ pass
80
95
 
81
96
  def getserial(self):
82
97
  machine_serial = None
@@ -123,8 +138,35 @@ class BaseMonitor(DaemonBase):
123
138
  except Exception as e:
124
139
  pass
125
140
 
141
+ def get_disk(self):
142
+ try:
143
+ list_metrics = ["read bytes", "write bytes", "read count", "write count", "read time", "write time"]
144
+ disk_io_counters = psutil.disk_io_counters(perdisk=False)
145
+ self.get_io_metrics("DISK", list_metrics, disk_io_counters)
146
+ except Exception as e:
147
+ pass
126
148
 
149
+ def get_network(self):
150
+ try:
151
+ list_metrics = ["bytes sent", "bytes recv", "packets sent", "packets recv"]
152
+ net_io_counters = psutil.net_io_counters(pernic=False)
153
+ self.get_io_metrics("NET", list_metrics, net_io_counters)
154
+ except Exception as e:
155
+ pass
127
156
 
157
+ def get_io_metrics(self, name, list_metrics, io_counters):
158
+ counters = io_counters._asdict()
159
+ prev_io_counters = self.previous_io_counters[name]._asdict()
160
+ time_diff = time.time() - self.previous_time[name]
161
+ for metric_name in list_metrics:
162
+ metric_key = metric_name.replace(' ', '_')
163
+ self.data[name][metric_name] = counters[metric_key] - prev_io_counters[metric_key]
164
+
165
+ if "bytes" in metric_name:
166
+ speed_metric = metric_name.replace("bytes", "speed")
167
+ self.data[name][speed_metric] = self.data[name][metric_name] / time_diff
168
+ self.previous_time[name] = time.time()
169
+ self.previous_io_counters[name] = io_counters
128
170
 
129
171
  if __name__ == "__main__":
130
172
  mon = BaseMonitor(period=10)
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.0.48'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.46
3
+ Version: 0.0.48
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
 
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.0.46'
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