sciveo 0.1.7__tar.gz → 0.1.8__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.1.7 → sciveo-0.1.8}/PKG-INFO +4 -2
- {sciveo-0.1.7 → sciveo-0.1.8}/README.md +3 -1
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/api/base.py +6 -3
- sciveo-0.1.8/sciveo/cli.py +39 -0
- sciveo-0.1.8/sciveo/common/tools/configuration.py +65 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/logger.py +4 -1
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/monitoring/monitor.py +1 -1
- sciveo-0.1.8/sciveo/version.py +2 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo.egg-info/PKG-INFO +4 -2
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo.egg-info/SOURCES.txt +3 -0
- sciveo-0.1.8/sciveo.egg-info/entry_points.txt +2 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/setup.py +6 -0
- sciveo-0.1.7/sciveo/version.py +0 -2
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/api/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/api/upload.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/configuration.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/model.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/optimizers.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/sampling.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/daemon.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/formating.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/hardware.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/synchronized.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/common/tools/timers.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/content/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/content/dataset.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/content/experiment.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/content/project.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/content/runner.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/monitoring/__init__.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/monitoring/network.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo/monitoring/start.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo.egg-info/dependency_links.txt +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo.egg-info/requires.txt +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/sciveo.egg-info/top_level.txt +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/setup.cfg +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/test/test_configuration.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/test/test_monitoring.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/test/test_runner.py +0 -0
- {sciveo-0.1.7 → sciveo-0.1.8}/test/test_sampling.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sciveo
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Provides-Extra: mon
|
|
6
6
|
Provides-Extra: net
|
|
@@ -49,10 +49,12 @@ When have sciveo account:
|
|
|
49
49
|
```shell
|
|
50
50
|
export SCIVEO_SECRET_ACCESS_KEY='my_sciveo_user_auth_token'
|
|
51
51
|
```
|
|
52
|
+
or create a file like ~/.sciveo/some_file_name where put:
|
|
53
|
+
secret_access_key=my_sciveo_user_auth_token
|
|
52
54
|
|
|
53
55
|
When using sciveo Monitoring just run, using suitable python environment
|
|
54
56
|
```shell
|
|
55
|
-
|
|
57
|
+
sciveo monitor --period 120
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
Monitoring started along with other python code.
|
|
@@ -41,10 +41,12 @@ When have sciveo account:
|
|
|
41
41
|
```shell
|
|
42
42
|
export SCIVEO_SECRET_ACCESS_KEY='my_sciveo_user_auth_token'
|
|
43
43
|
```
|
|
44
|
+
or create a file like ~/.sciveo/some_file_name where put:
|
|
45
|
+
secret_access_key=my_sciveo_user_auth_token
|
|
44
46
|
|
|
45
47
|
When using sciveo Monitoring just run, using suitable python environment
|
|
46
48
|
```shell
|
|
47
|
-
|
|
49
|
+
sciveo monitor --period 120
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
Monitoring started along with other python code.
|
|
@@ -15,14 +15,17 @@ from urllib import request, parse
|
|
|
15
15
|
from urllib.error import HTTPError
|
|
16
16
|
|
|
17
17
|
from sciveo.common.tools.logger import *
|
|
18
|
+
from sciveo.common.tools.configuration import GlobalConfiguration
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class APIRemoteClient:
|
|
21
22
|
def __init__(self, base_url=None, ver=1):
|
|
23
|
+
self.config = GlobalConfiguration.get()
|
|
24
|
+
self.auth_token = None
|
|
22
25
|
if base_url is None:
|
|
23
|
-
base_url =
|
|
26
|
+
base_url = self.config["api_base_url"]
|
|
24
27
|
self.base_url = f"{base_url}/api/v{ver}/"
|
|
25
|
-
self.headers = { "Auth-Token":
|
|
28
|
+
self.headers = { "Auth-Token": self.config['secret_access_key'] }
|
|
26
29
|
debug(type(self).__name__, f"base url: {self.base_url}")
|
|
27
30
|
|
|
28
31
|
def POST_SCI(self, content_type, data, timeout=30):
|
|
@@ -44,7 +47,7 @@ class APIRemoteClient:
|
|
|
44
47
|
return result
|
|
45
48
|
|
|
46
49
|
def GET(self, url, timeout=30):
|
|
47
|
-
url = f"{self.base_url}{url}&auth_token={
|
|
50
|
+
url = f"{self.base_url}{url}&auth_token={self.config['secret_access_key']}"
|
|
48
51
|
result = False
|
|
49
52
|
try:
|
|
50
53
|
# debug("GET", url)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Pavlin Georgiev, Softel Labs
|
|
4
|
+
#
|
|
5
|
+
# This is a proprietary file and may not be copied,
|
|
6
|
+
# distributed, or modified without express permission
|
|
7
|
+
# from the owner. For licensing inquiries, please
|
|
8
|
+
# contact pavlin@softel.bg.
|
|
9
|
+
#
|
|
10
|
+
# 2024
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import argparse
|
|
15
|
+
|
|
16
|
+
from sciveo.common.tools.logger import *
|
|
17
|
+
from sciveo.monitoring.start import MonitorStart
|
|
18
|
+
from sciveo.common.tools.configuration import GlobalConfiguration
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def main():
|
|
22
|
+
config = GlobalConfiguration.get()
|
|
23
|
+
|
|
24
|
+
parser = argparse.ArgumentParser(description='sciveo CLI')
|
|
25
|
+
parser.add_argument('command', choices=['monitor', 'net'], help='Command to execute')
|
|
26
|
+
parser.add_argument('--period', type=int, default=120, help='Period in seconds')
|
|
27
|
+
parser.add_argument('--block', type=bool, default=True, help='Block flag')
|
|
28
|
+
parser.add_argument('--auth', type=str, default=config['secret_access_key'], help='Auth secret access key')
|
|
29
|
+
args = parser.parse_args()
|
|
30
|
+
|
|
31
|
+
if args.command == 'monitor':
|
|
32
|
+
MonitorStart(period=args.period, block=args.block)()
|
|
33
|
+
elif args.command == 'net':
|
|
34
|
+
warning(args.command, "not implemented")
|
|
35
|
+
else:
|
|
36
|
+
warning(args.command, "not implemented")
|
|
37
|
+
|
|
38
|
+
if __name__ == '__main__':
|
|
39
|
+
main()
|
|
@@ -0,0 +1,65 @@
|
|
|
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 threading
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class GlobalConfiguration:
|
|
17
|
+
config = None
|
|
18
|
+
lock_config = threading.Lock()
|
|
19
|
+
|
|
20
|
+
def __init__(self) -> None:
|
|
21
|
+
home = os.path.expanduser('~')
|
|
22
|
+
self.base_path = os.path.join(home, '.sciveo')
|
|
23
|
+
self.data = {}
|
|
24
|
+
|
|
25
|
+
self.default = {
|
|
26
|
+
"api_base_url": "https://sciveo.com",
|
|
27
|
+
"log_min_level": "DEBUG"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
self.read_local_files()
|
|
32
|
+
self.read_environment()
|
|
33
|
+
except Exception as e:
|
|
34
|
+
error(type(self).__name__, "Exception", e)
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def get():
|
|
38
|
+
with GlobalConfiguration.lock_config:
|
|
39
|
+
if GlobalConfiguration.config is None:
|
|
40
|
+
GlobalConfiguration.config = GlobalConfiguration()
|
|
41
|
+
return GlobalConfiguration.config
|
|
42
|
+
|
|
43
|
+
def __getitem__(self, key):
|
|
44
|
+
key = key.lower()
|
|
45
|
+
return self.data.get(key, self.default.get(key, ""))
|
|
46
|
+
|
|
47
|
+
def read_environment(self):
|
|
48
|
+
for k, v in os.environ.items():
|
|
49
|
+
k = k.lower()
|
|
50
|
+
if k.startswith("sciveo_"):
|
|
51
|
+
k = k.replace("sciveo_", "")
|
|
52
|
+
self.data[k] = v
|
|
53
|
+
|
|
54
|
+
def read_local_files(self):
|
|
55
|
+
if os.path.exists(self.base_path):
|
|
56
|
+
for path, _, files in os.walk(self.base_path):
|
|
57
|
+
for file_name in files:
|
|
58
|
+
with open(os.path.join(path, file_name), 'r') as fp:
|
|
59
|
+
lines = fp.readlines()
|
|
60
|
+
for line in lines:
|
|
61
|
+
parts = line.strip().split('=')
|
|
62
|
+
if len(parts) == 2:
|
|
63
|
+
key = parts[0].strip().lower().replace("sciveo_", "")
|
|
64
|
+
value = parts[1].strip()
|
|
65
|
+
self.data[key] = value
|
|
@@ -13,8 +13,11 @@ import os
|
|
|
13
13
|
import logging
|
|
14
14
|
import threading
|
|
15
15
|
|
|
16
|
+
from sciveo.common.tools.configuration import GlobalConfiguration
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
config = GlobalConfiguration.get()
|
|
20
|
+
log_min_level = config["LOG_MIN_LEVEL"]
|
|
18
21
|
|
|
19
22
|
def get_logger(name):
|
|
20
23
|
logger = logging.getLogger(name)
|
|
@@ -110,7 +110,7 @@ class BaseMonitor(DaemonBase):
|
|
|
110
110
|
temperatures = psutil.sensors_temperatures()
|
|
111
111
|
for k, v in temperatures.items():
|
|
112
112
|
self.data["TEMP"][k] = [t.current for t in v]
|
|
113
|
-
except Exception:
|
|
113
|
+
except Exception as e:
|
|
114
114
|
pass
|
|
115
115
|
|
|
116
116
|
def get_memory(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sciveo
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Provides-Extra: mon
|
|
6
6
|
Provides-Extra: net
|
|
@@ -49,10 +49,12 @@ When have sciveo account:
|
|
|
49
49
|
```shell
|
|
50
50
|
export SCIVEO_SECRET_ACCESS_KEY='my_sciveo_user_auth_token'
|
|
51
51
|
```
|
|
52
|
+
or create a file like ~/.sciveo/some_file_name where put:
|
|
53
|
+
secret_access_key=my_sciveo_user_auth_token
|
|
52
54
|
|
|
53
55
|
When using sciveo Monitoring just run, using suitable python environment
|
|
54
56
|
```shell
|
|
55
|
-
|
|
57
|
+
sciveo monitor --period 120
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
Monitoring started along with other python code.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
setup.py
|
|
3
3
|
sciveo/__init__.py
|
|
4
|
+
sciveo/cli.py
|
|
4
5
|
sciveo/version.py
|
|
5
6
|
sciveo.egg-info/PKG-INFO
|
|
6
7
|
sciveo.egg-info/SOURCES.txt
|
|
7
8
|
sciveo.egg-info/dependency_links.txt
|
|
9
|
+
sciveo.egg-info/entry_points.txt
|
|
8
10
|
sciveo.egg-info/requires.txt
|
|
9
11
|
sciveo.egg-info/top_level.txt
|
|
10
12
|
sciveo/api/__init__.py
|
|
@@ -16,6 +18,7 @@ sciveo/common/model.py
|
|
|
16
18
|
sciveo/common/optimizers.py
|
|
17
19
|
sciveo/common/sampling.py
|
|
18
20
|
sciveo/common/tools/__init__.py
|
|
21
|
+
sciveo/common/tools/configuration.py
|
|
19
22
|
sciveo/common/tools/daemon.py
|
|
20
23
|
sciveo/common/tools/formating.py
|
|
21
24
|
sciveo/common/tools/hardware.py
|
sciveo-0.1.7/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
|