sciveo 0.0.22__tar.gz → 0.0.24__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 (37) hide show
  1. {sciveo-0.0.22 → sciveo-0.0.24}/PKG-INFO +2 -1
  2. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/api/base.py +3 -3
  3. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/api/upload.py +2 -1
  4. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/optimizers.py +13 -0
  5. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/hardware.py +1 -1
  6. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/content/experiment.py +2 -2
  7. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/content/project.py +2 -2
  8. sciveo-0.0.24/sciveo/monitoring/__init__.py +0 -0
  9. sciveo-0.0.24/sciveo/monitoring/monitor.py +61 -0
  10. sciveo-0.0.24/sciveo/version.py +2 -0
  11. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo.egg-info/PKG-INFO +2 -1
  12. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo.egg-info/SOURCES.txt +2 -0
  13. sciveo-0.0.24/sciveo.egg-info/requires.txt +6 -0
  14. {sciveo-0.0.22 → sciveo-0.0.24}/setup.py +7 -1
  15. sciveo-0.0.22/sciveo/version.py +0 -2
  16. sciveo-0.0.22/sciveo.egg-info/requires.txt +0 -2
  17. {sciveo-0.0.22 → sciveo-0.0.24}/README.md +0 -0
  18. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/__init__.py +0 -0
  19. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/api/__init__.py +0 -0
  20. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/__init__.py +0 -0
  21. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/configuration.py +0 -0
  22. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/model.py +0 -0
  23. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/sampling.py +0 -0
  24. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/__init__.py +0 -0
  25. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/daemon.py +0 -0
  26. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/formating.py +0 -0
  27. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/logger.py +0 -0
  28. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/common/tools/synchronized.py +0 -0
  29. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/content/__init__.py +0 -0
  30. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/content/dataset.py +0 -0
  31. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo/content/runner.py +0 -0
  32. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo.egg-info/dependency_links.txt +0 -0
  33. {sciveo-0.0.22 → sciveo-0.0.24}/sciveo.egg-info/top_level.txt +0 -0
  34. {sciveo-0.0.22 → sciveo-0.0.24}/setup.cfg +0 -0
  35. {sciveo-0.0.22 → sciveo-0.0.24}/test/test_configuration.py +0 -0
  36. {sciveo-0.0.22 → sciveo-0.0.24}/test/test_runner.py +0 -0
  37. {sciveo-0.0.22 → sciveo-0.0.24}/test/test_sampling.py +0 -0
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Description-Content-Type: text/markdown
5
+ Provides-Extra: mon
5
6
 
6
7
  # SCIVEO - ML/Scientific Experiments Management Client
7
8
 
@@ -26,10 +26,10 @@ class APIRemoteClient:
26
26
  self.headers = { "Auth-Token": os.environ['SCIVEO_SECRET_ACCESS_KEY'] }
27
27
  debug(type(self).__name__, f"base url: {self.base_url}")
28
28
 
29
- def POST(self, content_type, data, timeout=30):
30
- return self.POST_URL(f"sci/{content_type}/", data, timeout)
29
+ def POST_SCI(self, content_type, data, timeout=30):
30
+ return self.POST(f"sci/{content_type}/", data, timeout)
31
31
 
32
- def POST_URL(self, url, data, timeout=30):
32
+ def POST(self, url, data, timeout=30):
33
33
  url = f"{self.base_url}{url}"
34
34
  result = False
35
35
  try:
@@ -13,7 +13,6 @@ import os
13
13
  import json
14
14
  from urllib import request, parse
15
15
  from urllib.error import HTTPError
16
- import requests
17
16
 
18
17
  from sciveo.common.tools.logger import *
19
18
  from sciveo.api.base import *
@@ -30,6 +29,8 @@ class APIFileUploader:
30
29
  APIFileUploader.api = APIRemoteClient()
31
30
 
32
31
  def __call__(self):
32
+ import requests
33
+
33
34
  file_name = self.local_path.split("/")[-1]
34
35
  url_presigned_post = f"aws/s3/presigned_post/?content_type={self.content_type}&file_name={file_name}"
35
36
  presigned_post = APIFileUploader.api.GET(url_presigned_post)
@@ -67,6 +67,19 @@ class BaseOptimizer:
67
67
  return delta_y, self.list_to_x(x, x_new)
68
68
 
69
69
 
70
+ class HistoryGradientOptimizer(BaseOptimizer):
71
+ def __init__(self, keys, use_keys, learning_rate=0.01, learning_rate_decay=0.001):
72
+ super().__init__(keys, use_keys, learning_rate, learning_rate_decay)
73
+
74
+ def update(self, list_samples):
75
+ for i in range(len(list_samples) - 1):
76
+ x1, y1 = list_samples[i]
77
+ x2, y2 = list_samples[i + 1]
78
+
79
+ x11, x22 = self.x_to_list(x1, x2)
80
+ grads, delta_x, delta_y = self.gradients(x11, y1, x22, y2)
81
+
82
+
70
83
  class AdamOptimizer(BaseOptimizer):
71
84
  def __init__(self, keys, use_keys, learning_rate=0.01, learning_rate_decay=0.001, beta1=0.9, beta2=0.999, epsilon=1e-8):
72
85
  super().__init__(keys, use_keys, learning_rate, learning_rate_decay)
@@ -40,4 +40,4 @@ class HardwareInfo:
40
40
 
41
41
  self.data["CPU"]["info"] = cpu_info
42
42
  except Exception:
43
- return
43
+ return
@@ -151,7 +151,7 @@ class RemoteExperiment(Experiment):
151
151
  remote_data["project_guid"] = self.project_guid
152
152
  else:
153
153
  remote_data["project_name"] = self.project_name
154
- result = self.api.POST("experiment", remote_data)
154
+ result = self.api.POST_SCI("experiment", remote_data)
155
155
  debug(type(self).__name__, "init", self.name, "api", result)
156
156
  if result and "error" not in result:
157
157
  if result["name"] == self.name:
@@ -168,7 +168,7 @@ class RemoteExperiment(Experiment):
168
168
  "project_guid": self.project_guid,
169
169
  "data": self.data
170
170
  }
171
- result = self.api.POST("experiment", remote_data)
171
+ result = self.api.POST_SCI("experiment", remote_data)
172
172
  debug(type(self).__name__, "close", self.name, "api", result)
173
173
 
174
174
  def on_guid(self, guid):
@@ -75,7 +75,7 @@ class RemoteProject(ProjectBase):
75
75
  }
76
76
  if parent_id is not None:
77
77
  remote_data["parent_id"] = parent_id
78
- result = self.api.POST("project", remote_data)
78
+ result = self.api.POST_SCI("project", remote_data)
79
79
  debug(type(self).__name__, "init api", result)
80
80
  if result and "error" not in result:
81
81
  if result["name"] == project_name:
@@ -100,7 +100,7 @@ class RemoteProject(ProjectBase):
100
100
  "guid": self.guid,
101
101
  "data": self.project_data
102
102
  }
103
- result = self.api.POST("project", remote_data)
103
+ result = self.api.POST_SCI("project", remote_data)
104
104
  debug(type(self).__name__, "close", self.project_name, "api", result)
105
105
 
106
106
 
File without changes
@@ -0,0 +1,61 @@
1
+ #
2
+ # Pavlin Georgiev, Softel Labs
3
+ #
4
+ # This is a proprietary file and may not be copied,
5
+ # distributed, or modified without express permission
6
+ # from the owner. For licensing inquiries, please
7
+ # contact pavlin@softel.bg.
8
+ #
9
+ # 2024
10
+ #
11
+
12
+ import os
13
+ import time
14
+ import psutil
15
+ import numpy as np
16
+
17
+ from sciveo.common.tools.logger import *
18
+ from sciveo.common.tools.daemon import DaemonBase
19
+ from sciveo.common.tools.hardware import HardwareInfo
20
+ from sciveo.common.tools.formating import format_memory_size
21
+ from sciveo.api.base import APIRemoteClient
22
+
23
+
24
+ class BaseMonitor(DaemonBase):
25
+ def __init__(self, period=5):
26
+ super().__init__(period=period)
27
+ self.data = HardwareInfo()()
28
+ self.data.setdefault("CPU", {})
29
+ self.data["RAM"] = {
30
+ "installed": self.data["RAM"]
31
+ }
32
+ psutil.cpu_percent(interval=0.5)
33
+ self.api = APIRemoteClient()
34
+
35
+ def __call__(self):
36
+ return self.data
37
+
38
+ def loop(self):
39
+ self.get_cpu_usage()
40
+ self.get_memory()
41
+ debug(type(self).__name__, "loop", self())
42
+
43
+ def get_cpu_usage(self):
44
+ self.data["CPU"]["usage_per_core"] = psutil.cpu_percent(interval=None, percpu=True)
45
+ # self.data["CPU"]["usage_per_core"] = (np.array(self.data["CPU"]["usage_per_core"]) / 100.0).tolist()
46
+ self.data["CPU"]["usage"] = np.array(self.data["CPU"]["usage_per_core"]).mean()
47
+
48
+ def get_memory(self):
49
+ memory = psutil.virtual_memory()
50
+ self.data["RAM"]["total"] = memory.total
51
+ self.data["RAM"]["used"] = memory.used
52
+ self.data["RAM"]["free"] = memory.free
53
+ self.data["RAM"]["print"] = f"total: {format_memory_size(memory.total)} used: {format_memory_size(memory.used)}"
54
+
55
+
56
+ if __name__ == "__main__":
57
+ mon = BaseMonitor(period=10)
58
+ mon.start()
59
+
60
+ while(True):
61
+ time.sleep(30)
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.0.24'
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Description-Content-Type: text/markdown
5
+ Provides-Extra: mon
5
6
 
6
7
  # SCIVEO - ML/Scientific Experiments Management Client
7
8
 
@@ -26,6 +26,8 @@ sciveo/content/dataset.py
26
26
  sciveo/content/experiment.py
27
27
  sciveo/content/project.py
28
28
  sciveo/content/runner.py
29
+ sciveo/monitoring/__init__.py
30
+ sciveo/monitoring/monitor.py
29
31
  test/test_configuration.py
30
32
  test/test_runner.py
31
33
  test/test_sampling.py
@@ -0,0 +1,6 @@
1
+ numpy>=0.0.0
2
+ requests>=0.0.0
3
+
4
+ [mon]
5
+ psutil>=0.0.0
6
+ sciveo.monitoring
@@ -7,8 +7,14 @@ setup(
7
7
  packages=find_packages(),
8
8
  install_requires=[
9
9
  'numpy>=0.0.0',
10
- 'requests>=0.0.0'
10
+ 'requests>=0.0.0',
11
11
  ],
12
12
  long_description=open('README.md').read(),
13
13
  long_description_content_type='text/markdown',
14
+ extras_require={
15
+ 'mon': [
16
+ 'psutil>=0.0.0',
17
+ 'sciveo.monitoring',
18
+ ]
19
+ },
14
20
  )
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.0.22'
@@ -1,2 +0,0 @@
1
- numpy>=0.0.0
2
- requests>=0.0.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes