sciveo 0.0.31__tar.gz → 0.0.32__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 (36) hide show
  1. {sciveo-0.0.31 → sciveo-0.0.32}/PKG-INFO +1 -1
  2. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/hardware.py +45 -2
  3. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/monitoring/monitor.py +10 -9
  4. sciveo-0.0.32/sciveo/version.py +2 -0
  5. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo.egg-info/PKG-INFO +1 -1
  6. sciveo-0.0.31/sciveo/version.py +0 -2
  7. {sciveo-0.0.31 → sciveo-0.0.32}/README.md +0 -0
  8. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/__init__.py +0 -0
  9. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/api/__init__.py +0 -0
  10. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/api/base.py +0 -0
  11. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/api/upload.py +0 -0
  12. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/__init__.py +0 -0
  13. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/configuration.py +0 -0
  14. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/model.py +0 -0
  15. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/optimizers.py +0 -0
  16. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/sampling.py +0 -0
  17. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/__init__.py +0 -0
  18. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/daemon.py +0 -0
  19. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/formating.py +0 -0
  20. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/logger.py +0 -0
  21. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/common/tools/synchronized.py +0 -0
  22. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/content/__init__.py +0 -0
  23. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/content/dataset.py +0 -0
  24. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/content/experiment.py +0 -0
  25. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/content/project.py +0 -0
  26. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/content/runner.py +0 -0
  27. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo/monitoring/__init__.py +0 -0
  28. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo.egg-info/SOURCES.txt +0 -0
  29. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo.egg-info/dependency_links.txt +0 -0
  30. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo.egg-info/requires.txt +0 -0
  31. {sciveo-0.0.31 → sciveo-0.0.32}/sciveo.egg-info/top_level.txt +0 -0
  32. {sciveo-0.0.31 → sciveo-0.0.32}/setup.cfg +0 -0
  33. {sciveo-0.0.31 → sciveo-0.0.32}/setup.py +0 -0
  34. {sciveo-0.0.31 → sciveo-0.0.32}/test/test_configuration.py +0 -0
  35. {sciveo-0.0.31 → sciveo-0.0.32}/test/test_runner.py +0 -0
  36. {sciveo-0.0.31 → sciveo-0.0.32}/test/test_sampling.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.31
3
+ Version: 0.0.32
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
 
@@ -10,11 +10,13 @@
10
10
  #
11
11
 
12
12
  import os
13
+ import subprocess
13
14
  import datetime
14
15
  import uuid
15
16
  import random
16
17
  import string
17
18
 
19
+ from sciveo.common.tools.logger import *
18
20
  from sciveo.common.tools.formating import format_memory_size
19
21
 
20
22
 
@@ -36,12 +38,13 @@ class HardwareInfo:
36
38
  "RAM": format_memory_size(os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES'))
37
39
  }
38
40
 
39
- self.get_cpuinfo()
41
+ self.get_cpu()
42
+ self.get_gpu()
40
43
 
41
44
  def __call__(self):
42
45
  return self.data
43
46
 
44
- def get_cpuinfo(self):
47
+ def get_cpu(self):
45
48
  list_keys = ["model name", "stepping", "cpu MHz", "cache size", "siblings", "cpu cores", "bogomips"]
46
49
  try:
47
50
  cpu_info = {}
@@ -57,3 +60,43 @@ class HardwareInfo:
57
60
  self.data["CPU"]["info"] = cpu_info
58
61
  except Exception:
59
62
  return
63
+
64
+ # Currently simple nvidia-smi wrapper impl
65
+ def get_gpu(self):
66
+ try:
67
+ result = subprocess.run(
68
+ [
69
+ 'nvidia-smi',
70
+ '--query-gpu=gpu_uuid,gpu_name,index,power.draw,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu',
71
+ '--format=csv'
72
+ ],
73
+ capture_output=True, text=True, check=True
74
+ )
75
+
76
+ lines = result.stdout.strip().split('\n')
77
+ header = lines[0].split(", ")
78
+
79
+ keys = []
80
+ units = {}
81
+ for k in header:
82
+ k_split = k.split(' ')
83
+ key = k_split[0]
84
+ keys.append(key)
85
+ if len(k_split) >= 2:
86
+ units[key] = k_split[1].replace('[', '').replace(']', '')
87
+
88
+ for i in range(1, len(lines)):
89
+ line_values = lines[i].split(", ")
90
+ line_data = {}
91
+ for j, value in enumerate(line_values):
92
+ value = value.split(' ')[0]
93
+ line_data[keys[j]] = value
94
+ self.data.setdefault("GPU", [])
95
+ self.data["GPU"].append(line_data)
96
+ except subprocess.CalledProcessError as e:
97
+ pass
98
+
99
+
100
+ if __name__ == "__main__":
101
+ hw = HardwareInfo()
102
+ hw()
@@ -33,15 +33,19 @@ class BaseMonitor(DaemonBase):
33
33
  "installed": self.data["RAM"]
34
34
  }
35
35
 
36
- self.initial_cpu_usage = psutil.cpu_percent(interval=5, percpu=True)
37
- cpuserial = self.getserial()
38
-
39
36
  self.data["logs"] = {}
40
37
  self.list_logs = []
41
38
 
42
39
  self.api = APIRemoteClient()
43
40
 
44
- debug(type(self).__name__, "init", cpuserial, "initial_cpu_usage", self.initial_cpu_usage)
41
+ # Warmup the psutil cpu usage
42
+ psutil.cpu_percent(interval=0.3, percpu=True)
43
+ initial_cpu_usage = psutil.cpu_percent(interval=None, percpu=True)
44
+ time.sleep(1)
45
+
46
+ cpuserial = self.getserial()
47
+
48
+ debug(type(self).__name__, "init", cpuserial, "initial_cpu_usage", initial_cpu_usage)
45
49
 
46
50
  def __call__(self):
47
51
  return self.data
@@ -62,11 +66,7 @@ class BaseMonitor(DaemonBase):
62
66
  self.data["logs"][log_name] = self.tail_file(log_path)[-3:]
63
67
 
64
68
  def get_cpu_usage(self):
65
- if self.initial_cpu_usage is None:
66
- self.data["CPU"]["usage_per_core"] = psutil.cpu_percent(interval=None, percpu=True)
67
- else:
68
- self.data["CPU"]["usage_per_core"] = self.initial_cpu_usage
69
- self.initial_cpu_usage = None
69
+ self.data["CPU"]["usage_per_core"] = psutil.cpu_percent(interval=None, percpu=True)
70
70
  # self.data["CPU"]["usage_per_core"] = (np.array(self.data["CPU"]["usage_per_core"]) / 100.0).tolist()
71
71
  self.data["CPU"]["usage"] = np.array(self.data["CPU"]["usage_per_core"]).mean()
72
72
 
@@ -107,6 +107,7 @@ class BaseMonitor(DaemonBase):
107
107
  return result
108
108
 
109
109
 
110
+
110
111
  if __name__ == "__main__":
111
112
  mon = BaseMonitor(period=60)
112
113
  mon.start()
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.0.32'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.31
3
+ Version: 0.0.32
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
 
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.0.31'
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