sciveo 0.1.59__tar.gz → 0.1.61__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.59 → sciveo-0.1.61}/PKG-INFO +88 -14
- {sciveo-0.1.59 → sciveo-0.1.61}/README.md +87 -13
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/cli.py +8 -3
- sciveo-0.1.61/sciveo/media/capture/cam.py +156 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/monitoring/watchdog/base.py +6 -5
- sciveo-0.1.61/sciveo/monitoring/watchdog/process.py +104 -0
- sciveo-0.1.61/sciveo/tools/draw/__init__.py +0 -0
- sciveo-0.1.61/sciveo/version.py +2 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/PKG-INFO +88 -14
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/SOURCES.txt +4 -1
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/requires.txt +2 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/setup.py +1 -1
- sciveo-0.1.59/sciveo/version.py +0 -2
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/api/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/api/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/api/predictors.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/api/server.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/api/upload.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/common/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/common/configuration.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/common/model.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/common/optimizers.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/common/sampling.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/content/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/content/dataset.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/content/experiment.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/content/project.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/content/runner.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/__init__.py +0 -0
- {sciveo-0.1.59/sciveo/media/ml → sciveo-0.1.61/sciveo/media/capture}/__init__.py +0 -0
- {sciveo-0.1.59/sciveo/media/tools → sciveo-0.1.61/sciveo/media/capture}/nvr.py +0 -0
- {sciveo-0.1.59/sciveo/media/ml/encoders → sciveo-0.1.61/sciveo/media/ml}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/base.py +0 -0
- {sciveo-0.1.59/sciveo/media/ml/nlp → sciveo-0.1.61/sciveo/media/ml/encoders}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/encoders/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/encoders/normalizer.py +0 -0
- {sciveo-0.1.59/sciveo/media/ml/time_series → sciveo-0.1.61/sciveo/media/ml/nlp}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/nlp/search.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines → sciveo-0.1.61/sciveo/media/ml/time_series}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/time_series/dataset.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/time_series/predictor.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/time_series/trainer.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/ml/time_series/window_generator.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/layouts → sciveo-0.1.61/sciveo/media/pipelines}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/job_daemon.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/postprocessors → sciveo-0.1.61/sciveo/media/pipelines/layouts}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/layouts/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/pipeline.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors → sciveo-0.1.61/sciveo/media/pipelines/postprocessors}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/postprocessors/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/postprocessors/default.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/audio → sciveo-0.1.61/sciveo/media/pipelines/processors}/__init__.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/file → sciveo-0.1.61/sciveo/media/pipelines/processors/audio}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/audio/audio.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/audio/audio_extractor_process.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/aws.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/base.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/image → sciveo-0.1.61/sciveo/media/pipelines/processors/file}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/file/archive.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/nlp → sciveo-0.1.61/sciveo/media/pipelines/processors/image}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/album.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/album_in_image.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/depth_esimation.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/embeddings.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/filters.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/generators.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/histogram.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/mask.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/object_detection.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/resize.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/segmentation.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/image/watermark.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/media_info.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/sci → sciveo-0.1.61/sciveo/media/pipelines/processors/nlp}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/nlp/address.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/qr.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/sci/time_series → sciveo-0.1.61/sciveo/media/pipelines/processors/sci}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/sci/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/sci/dataset.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/processors/video → sciveo-0.1.61/sciveo/media/pipelines/processors/sci/time_series}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/sci/time_series/predictor.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/sci/time_series/trainer.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/tpu_base.py +0 -0
- {sciveo-0.1.59/sciveo/media/pipelines/web → sciveo-0.1.61/sciveo/media/pipelines/processors/video}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/generators.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/motion_detection.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/resize.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/video_album.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/video_frames.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/processors/video/video_resample.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/queues.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/server.py +0 -0
- {sciveo-0.1.59/sciveo/media/tools → sciveo-0.1.61/sciveo/media/pipelines/web}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/pipelines/web/server.py +0 -0
- {sciveo-0.1.59/sciveo/ml → sciveo-0.1.61/sciveo/media/tools}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/media/tools/video_interactive.py +0 -0
- {sciveo-0.1.59/sciveo/ml/dataset → sciveo-0.1.61/sciveo/ml}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/base.py +0 -0
- {sciveo-0.1.59/sciveo/ml/evaluation → sciveo-0.1.61/sciveo/ml/dataset}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/dataset/object_detection.py +0 -0
- {sciveo-0.1.59/sciveo/ml/images → sciveo-0.1.61/sciveo/ml/evaluation}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/evaluation/markdown.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/evaluation/object_detection.py +0 -0
- {sciveo-0.1.59/sciveo/ml/nlp → sciveo-0.1.61/sciveo/ml/images}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/base.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/description.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/embeddings.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/object_detection.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/tools.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/images/transformers.py +0 -0
- {sciveo-0.1.59/sciveo/ml/nlp/tokenizers → sciveo-0.1.61/sciveo/ml/nlp}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/nlp/embeddings.py +0 -0
- {sciveo-0.1.59/sciveo/ml/video → sciveo-0.1.61/sciveo/ml/nlp/tokenizers}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/nlp/tokenizers/bpe.py +0 -0
- {sciveo-0.1.59/sciveo/monitoring → sciveo-0.1.61/sciveo/ml/video}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/ml/video/description.py +0 -0
- {sciveo-0.1.59/sciveo/monitoring/watchdog → sciveo-0.1.61/sciveo/monitoring}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/monitoring/monitor.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/monitoring/start.py +0 -0
- {sciveo-0.1.59/sciveo/network → sciveo-0.1.61/sciveo/monitoring/watchdog}/__init__.py +0 -0
- {sciveo-0.1.59/sciveo/tools → sciveo-0.1.61/sciveo/network}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/network/camera.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/network/sniffer.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/network/tools.py +0 -0
- {sciveo-0.1.59/sciveo/tools/aws → sciveo-0.1.61/sciveo/tools}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/array.py +0 -0
- {sciveo-0.1.59/sciveo/tools/draw → sciveo-0.1.61/sciveo/tools/aws}/__init__.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/aws/priority_queue.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/aws/s3.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/common.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/complexity.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/compress.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/configuration.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/crypto.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/daemon.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/draw/contours.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/formating.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/hardware.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/http.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/logger.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/os.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/queue.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/random.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/remote.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/simple_counter.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/synchronized.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo/tools/timers.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/dependency_links.txt +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/entry_points.txt +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/sciveo.egg-info/top_level.txt +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/setup.cfg +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_complexity.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_compress.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_configuration.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_crypto.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_eval_markdown.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_ml_datasets.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_monitoring.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_runner.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_sampling.py +0 -0
- {sciveo-0.1.59 → sciveo-0.1.61}/test/test_tokenizers.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.61
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
Provides-Extra: mon
|
|
6
6
|
Provides-Extra: net
|
|
@@ -12,17 +12,90 @@ Provides-Extra: ml
|
|
|
12
12
|
|
|
13
13
|
# SCIVEO - ML/AI and Scientific tools
|
|
14
14
|
|
|
15
|
+
## Monitoring ML Infrastructure
|
|
16
|
+
sciveo monitoring of (ML) machines' CPU/RAM/GPU/NET/DISK/TEMP etc.
|
|
17
|
+
It is very easy to start and use with a single command line.
|
|
18
|
+
|
|
19
|
+
- **Monitoring** of current machine with sampling period of 60 seconds
|
|
20
|
+
```shell
|
|
21
|
+
sciveo monitor --period 60
|
|
22
|
+
```
|
|
23
|
+
- **Monitoring** of current machine, logging the samples to local file (in this case the ./sciveo_monitor.json default name when dir path is used)
|
|
24
|
+
```shell
|
|
25
|
+
sciveo monitor --period 120 --output-path ./
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The monitor client is sendind the monitored samples to remote [sciveo](https://sciveo.com) api (init config located in ~/.sciveo/)
|
|
29
|
+
|
|
30
|
+
### Watchdog monitoring with action
|
|
31
|
+
- **Memory usage** watchdog for 90% max memory, measure every 10 seconds and execute "<some command to handle the high memory event>"
|
|
32
|
+
```shell
|
|
33
|
+
sciveo watchdog --src memory --threshold 90 --period 10 --execute "<some command to handle the high memory event>"
|
|
34
|
+
```
|
|
35
|
+
- **Disk usage** watchdog for 80% max disk usage on /some/path/to/watch path, measure every 600 seconds and execute "<some command to handle the high disk usage event>".
|
|
36
|
+
```shell
|
|
37
|
+
sciveo watchdog --src disk --input-path "/some/path/to/watch" --threshold 80 --period 600 --execute "find /some/path/to/watch -type f -mtime +1"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Network tools
|
|
42
|
+
|
|
43
|
+
- **Network Scan** Networks of hosts to scan for a single port
|
|
44
|
+
```shell
|
|
45
|
+
sciveo scan --port 22
|
|
46
|
+
|
|
47
|
+
sciveo scan --net 192.168.0.0/24 --port 22 --timeout 0.5
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **Network Scan** Single Host list of ports to scan
|
|
51
|
+
```shell
|
|
52
|
+
sciveo scan --host 192.168.0.10
|
|
53
|
+
|
|
54
|
+
sciveo scan --host 192.168.0.10 --ports [443,80]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Remote network video recorder
|
|
58
|
+
|
|
59
|
+
- **NVR** RTSP cams video recorder
|
|
60
|
+
```shell
|
|
61
|
+
sciveo nvr --input-path cams.json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
where cams.json has the cam and nvr configuration like
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"video_retention_period": 5,
|
|
68
|
+
"max_video_len": 60,
|
|
69
|
+
"transport": "tcp",
|
|
70
|
+
"path": {
|
|
71
|
+
"tmp": "tmp/nvr/tmp",
|
|
72
|
+
"video": "tmp/nvr/video"
|
|
73
|
+
},
|
|
74
|
+
"cam": {
|
|
75
|
+
"cam_livingroom": {
|
|
76
|
+
"url": "rtsp://192.168.1.11/stream1"
|
|
77
|
+
},
|
|
78
|
+
"cam_kitchen": {
|
|
79
|
+
"url": "rtsp://rtsp://192.168.1.12"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Media pipelines processing worker
|
|
87
|
+
- **Media Pipelines processing** service
|
|
88
|
+
```shell
|
|
89
|
+
sciveo media-server
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
15
93
|
## Experiments Management Client
|
|
16
94
|
`sciveo` is a Python library that serves as a client for managing machine learning and scientific experiments on the sciveo.com platform. This library provides a convenient interface to interact with the sciveo.com API, enabling users to organize, track, and analyze their experiments efficiently.
|
|
17
95
|
There are few configuration params samplers, which allows easy parameter tuning. The "auto" sampler perhaps is the easiest to use, but also
|
|
18
96
|
"random" and "grid" ones are available.
|
|
19
97
|
|
|
20
|
-
|
|
21
|
-
There is also the sciveo.monitor() which will start monitoring machine CPU/RAM/GPU/NET/DISK/TEMP etc.
|
|
22
|
-
It is very easy to start and use.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Features
|
|
98
|
+
#### Features
|
|
26
99
|
|
|
27
100
|
- **Experiment Tracking:** Easily log and track your machine learning experiments.
|
|
28
101
|
- **Experiment Comparison:** Compare different experiments and their results.
|
|
@@ -30,6 +103,7 @@ It is very easy to start and use.
|
|
|
30
103
|
- **Integration with sciveo.com:** Seamlessly connect and synchronize with the sciveo.com platform.
|
|
31
104
|
- **Monitoring machines (from HPC to jetson nano):** Visualisation and metrics collection in sciveo platform.
|
|
32
105
|
|
|
106
|
+
|
|
33
107
|
## Installation
|
|
34
108
|
|
|
35
109
|
- main sciveo
|
|
@@ -39,10 +113,15 @@ pip install sciveo
|
|
|
39
113
|
pip install sciveo[mon]
|
|
40
114
|
- optional for sciveo network tools
|
|
41
115
|
pip install sciveo[net]
|
|
42
|
-
|
|
43
|
-
- for full installation
|
|
116
|
+
- for full installation, without media and ML support
|
|
44
117
|
pip install sciveo[all]
|
|
45
118
|
|
|
119
|
+
- for media (images/video/audio/text)
|
|
120
|
+
pip install sciveo[media]
|
|
121
|
+
- for media with ML processors
|
|
122
|
+
pip install sciveo[media-ml]
|
|
123
|
+
|
|
124
|
+
|
|
46
125
|
## Example usage
|
|
47
126
|
|
|
48
127
|
There are few public examples in sciveo.com.
|
|
@@ -78,11 +157,6 @@ sciveo.monitor(period=120, block=False)
|
|
|
78
157
|
|
|
79
158
|
```
|
|
80
159
|
|
|
81
|
-
Sciveo Scan hosts port tool available
|
|
82
|
-
```shell
|
|
83
|
-
sciveo scan --port 22 --timeout 0.5
|
|
84
|
-
```
|
|
85
|
-
|
|
86
160
|
|
|
87
161
|
Experimental Projects management
|
|
88
162
|
|
|
@@ -1,16 +1,89 @@
|
|
|
1
1
|
# SCIVEO - ML/AI and Scientific tools
|
|
2
2
|
|
|
3
|
+
## Monitoring ML Infrastructure
|
|
4
|
+
sciveo monitoring of (ML) machines' CPU/RAM/GPU/NET/DISK/TEMP etc.
|
|
5
|
+
It is very easy to start and use with a single command line.
|
|
6
|
+
|
|
7
|
+
- **Monitoring** of current machine with sampling period of 60 seconds
|
|
8
|
+
```shell
|
|
9
|
+
sciveo monitor --period 60
|
|
10
|
+
```
|
|
11
|
+
- **Monitoring** of current machine, logging the samples to local file (in this case the ./sciveo_monitor.json default name when dir path is used)
|
|
12
|
+
```shell
|
|
13
|
+
sciveo monitor --period 120 --output-path ./
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The monitor client is sendind the monitored samples to remote [sciveo](https://sciveo.com) api (init config located in ~/.sciveo/)
|
|
17
|
+
|
|
18
|
+
### Watchdog monitoring with action
|
|
19
|
+
- **Memory usage** watchdog for 90% max memory, measure every 10 seconds and execute "<some command to handle the high memory event>"
|
|
20
|
+
```shell
|
|
21
|
+
sciveo watchdog --src memory --threshold 90 --period 10 --execute "<some command to handle the high memory event>"
|
|
22
|
+
```
|
|
23
|
+
- **Disk usage** watchdog for 80% max disk usage on /some/path/to/watch path, measure every 600 seconds and execute "<some command to handle the high disk usage event>".
|
|
24
|
+
```shell
|
|
25
|
+
sciveo watchdog --src disk --input-path "/some/path/to/watch" --threshold 80 --period 600 --execute "find /some/path/to/watch -type f -mtime +1"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Network tools
|
|
30
|
+
|
|
31
|
+
- **Network Scan** Networks of hosts to scan for a single port
|
|
32
|
+
```shell
|
|
33
|
+
sciveo scan --port 22
|
|
34
|
+
|
|
35
|
+
sciveo scan --net 192.168.0.0/24 --port 22 --timeout 0.5
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- **Network Scan** Single Host list of ports to scan
|
|
39
|
+
```shell
|
|
40
|
+
sciveo scan --host 192.168.0.10
|
|
41
|
+
|
|
42
|
+
sciveo scan --host 192.168.0.10 --ports [443,80]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Remote network video recorder
|
|
46
|
+
|
|
47
|
+
- **NVR** RTSP cams video recorder
|
|
48
|
+
```shell
|
|
49
|
+
sciveo nvr --input-path cams.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
where cams.json has the cam and nvr configuration like
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"video_retention_period": 5,
|
|
56
|
+
"max_video_len": 60,
|
|
57
|
+
"transport": "tcp",
|
|
58
|
+
"path": {
|
|
59
|
+
"tmp": "tmp/nvr/tmp",
|
|
60
|
+
"video": "tmp/nvr/video"
|
|
61
|
+
},
|
|
62
|
+
"cam": {
|
|
63
|
+
"cam_livingroom": {
|
|
64
|
+
"url": "rtsp://192.168.1.11/stream1"
|
|
65
|
+
},
|
|
66
|
+
"cam_kitchen": {
|
|
67
|
+
"url": "rtsp://rtsp://192.168.1.12"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Media pipelines processing worker
|
|
75
|
+
- **Media Pipelines processing** service
|
|
76
|
+
```shell
|
|
77
|
+
sciveo media-server
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
|
|
3
81
|
## Experiments Management Client
|
|
4
82
|
`sciveo` is a Python library that serves as a client for managing machine learning and scientific experiments on the sciveo.com platform. This library provides a convenient interface to interact with the sciveo.com API, enabling users to organize, track, and analyze their experiments efficiently.
|
|
5
83
|
There are few configuration params samplers, which allows easy parameter tuning. The "auto" sampler perhaps is the easiest to use, but also
|
|
6
84
|
"random" and "grid" ones are available.
|
|
7
85
|
|
|
8
|
-
|
|
9
|
-
There is also the sciveo.monitor() which will start monitoring machine CPU/RAM/GPU/NET/DISK/TEMP etc.
|
|
10
|
-
It is very easy to start and use.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Features
|
|
86
|
+
#### Features
|
|
14
87
|
|
|
15
88
|
- **Experiment Tracking:** Easily log and track your machine learning experiments.
|
|
16
89
|
- **Experiment Comparison:** Compare different experiments and their results.
|
|
@@ -18,6 +91,7 @@ It is very easy to start and use.
|
|
|
18
91
|
- **Integration with sciveo.com:** Seamlessly connect and synchronize with the sciveo.com platform.
|
|
19
92
|
- **Monitoring machines (from HPC to jetson nano):** Visualisation and metrics collection in sciveo platform.
|
|
20
93
|
|
|
94
|
+
|
|
21
95
|
## Installation
|
|
22
96
|
|
|
23
97
|
- main sciveo
|
|
@@ -27,10 +101,15 @@ pip install sciveo
|
|
|
27
101
|
pip install sciveo[mon]
|
|
28
102
|
- optional for sciveo network tools
|
|
29
103
|
pip install sciveo[net]
|
|
30
|
-
|
|
31
|
-
- for full installation
|
|
104
|
+
- for full installation, without media and ML support
|
|
32
105
|
pip install sciveo[all]
|
|
33
106
|
|
|
107
|
+
- for media (images/video/audio/text)
|
|
108
|
+
pip install sciveo[media]
|
|
109
|
+
- for media with ML processors
|
|
110
|
+
pip install sciveo[media-ml]
|
|
111
|
+
|
|
112
|
+
|
|
34
113
|
## Example usage
|
|
35
114
|
|
|
36
115
|
There are few public examples in sciveo.com.
|
|
@@ -66,11 +145,6 @@ sciveo.monitor(period=120, block=False)
|
|
|
66
145
|
|
|
67
146
|
```
|
|
68
147
|
|
|
69
|
-
Sciveo Scan hosts port tool available
|
|
70
|
-
```shell
|
|
71
|
-
sciveo scan --port 22 --timeout 0.5
|
|
72
|
-
```
|
|
73
|
-
|
|
74
148
|
|
|
75
149
|
Experimental Projects management
|
|
76
150
|
|
|
@@ -51,8 +51,9 @@ def main():
|
|
|
51
51
|
parser.add_argument('--src', type=str, default=None, help='Source')
|
|
52
52
|
parser.add_argument('--dst', type=str, default=None, help='Destination')
|
|
53
53
|
parser.add_argument('--value', type=float, help='Value')
|
|
54
|
-
parser.add_argument('--threshold', type=float, help='Threshold')
|
|
54
|
+
parser.add_argument('--threshold', type=float, default=None, help='Threshold')
|
|
55
55
|
parser.add_argument('--execute', type=str, default=None, help='Execute command')
|
|
56
|
+
parser.add_argument('--pid', type=int, default=None, help='Process PID')
|
|
56
57
|
|
|
57
58
|
args = parser.parse_args()
|
|
58
59
|
|
|
@@ -83,7 +84,7 @@ def main():
|
|
|
83
84
|
else:
|
|
84
85
|
info(f"init, [{base_path}] already there")
|
|
85
86
|
elif args.command == 'nvr':
|
|
86
|
-
from sciveo.media.
|
|
87
|
+
from sciveo.media.capture.nvr import VideoRecorder
|
|
87
88
|
VideoRecorder(args.input_path).start()
|
|
88
89
|
elif args.command == 'media-server':
|
|
89
90
|
from sciveo.media.pipelines.server import __START_SCIVEO_MEDIA_SERVER__
|
|
@@ -93,13 +94,17 @@ def main():
|
|
|
93
94
|
from sciveo.media.pipelines.processors.audio.audio_extractor_process import plot_audio
|
|
94
95
|
plot_audio(args.width, args.height, args.rate, args.input_path, args.output_path)
|
|
95
96
|
elif args.command == 'watchdog':
|
|
96
|
-
from sciveo.monitoring.watchdog.base import MemoryWatchDogDaemon, DiskWatchDogDaemon
|
|
97
97
|
daemons = []
|
|
98
98
|
if args.execute is not None:
|
|
99
99
|
if args.src is None or args.src.startswith("mem"):
|
|
100
|
+
from sciveo.monitoring.watchdog.base import MemoryWatchDogDaemon
|
|
100
101
|
daemons.append(MemoryWatchDogDaemon(threshold_percent=args.threshold, period=args.period, command=args.execute))
|
|
101
102
|
elif args.src.startswith("disk") and args.input_path is not None:
|
|
103
|
+
from sciveo.monitoring.watchdog.base import DiskWatchDogDaemon
|
|
102
104
|
daemons.append(DiskWatchDogDaemon(path=args.input_path, threshold_percent=args.threshold, period=args.period, command=args.execute))
|
|
105
|
+
elif args.src.startswith("process"):
|
|
106
|
+
from sciveo.monitoring.watchdog.process import ProcessWatchDogDaemon
|
|
107
|
+
daemons.append(ProcessWatchDogDaemon(pid=args.pid, process_cmd=args.dst, period=args.period, command=args.execute, thread_inactive_threshold=args.threshold))
|
|
103
108
|
for daemon in daemons:
|
|
104
109
|
daemon.start()
|
|
105
110
|
while(True):
|
|
@@ -0,0 +1,156 @@
|
|
|
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 time
|
|
13
|
+
import numpy as np
|
|
14
|
+
import cv2
|
|
15
|
+
import base64
|
|
16
|
+
import threading
|
|
17
|
+
import mss
|
|
18
|
+
|
|
19
|
+
from sciveo.tools.logger import *
|
|
20
|
+
from sciveo.tools.daemon import DaemonBase
|
|
21
|
+
from sciveo.tools.timers import FPSCounter
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CaptureBase(DaemonBase):
|
|
25
|
+
def __init__(self, src, tag="capture", period=0):
|
|
26
|
+
super().__init__(period=period)
|
|
27
|
+
self.src = src
|
|
28
|
+
self.tag = tag
|
|
29
|
+
self.lock_frame = threading.Lock()
|
|
30
|
+
self.frame = None
|
|
31
|
+
self.fps = FPSCounter(period=10, tag=f"{self.tag} [{self.src}]")
|
|
32
|
+
|
|
33
|
+
def close(self):
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
def read(self):
|
|
37
|
+
with self.lock_frame:
|
|
38
|
+
return self.frame
|
|
39
|
+
|
|
40
|
+
def read_buf(self):
|
|
41
|
+
frame = self.read()
|
|
42
|
+
ret, buffer = cv2.imencode('.jpg', frame)
|
|
43
|
+
return buffer.tobytes()
|
|
44
|
+
|
|
45
|
+
def read_frame(self):
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
def loop(self):
|
|
49
|
+
with self.lock_frame:
|
|
50
|
+
self.read_frame()
|
|
51
|
+
self.fps.update()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class CameraDaemon(CaptureBase):
|
|
55
|
+
def __init__(self, cam_id=0, period=0):
|
|
56
|
+
super().__init__(src=cam_id, tag="cam", period=period)
|
|
57
|
+
self.cap = cv2.VideoCapture(cam_id)
|
|
58
|
+
debug(cam_id, "warming...")
|
|
59
|
+
time.sleep(1)
|
|
60
|
+
|
|
61
|
+
def close(self):
|
|
62
|
+
self.cap.release()
|
|
63
|
+
|
|
64
|
+
def read_frame(self):
|
|
65
|
+
ret, self.frame = self.cap.read()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class PredictorCameraDaemon(DaemonBase):
|
|
69
|
+
def __init__(self, args, cam, client):
|
|
70
|
+
super().__init__()
|
|
71
|
+
self.args = args
|
|
72
|
+
self.client = client
|
|
73
|
+
self.cam = cam
|
|
74
|
+
self.frame = None
|
|
75
|
+
self.fps = FPSCounter(period=10, tag="predictor")
|
|
76
|
+
self.lock_frame = threading.Lock()
|
|
77
|
+
|
|
78
|
+
def loop(self):
|
|
79
|
+
frame = self.cam.read()
|
|
80
|
+
image_base64 = self.client.image_encoded(image=frame)
|
|
81
|
+
|
|
82
|
+
if self.args.input_type == 0:
|
|
83
|
+
params = {
|
|
84
|
+
"predictor": self.args.predictor,
|
|
85
|
+
"compressed": self.args.compressed,
|
|
86
|
+
"X": [{
|
|
87
|
+
"messages": [{
|
|
88
|
+
"role": "user",
|
|
89
|
+
"content": [
|
|
90
|
+
{"type": "image"},
|
|
91
|
+
{"type": "text", "text": self.args.prompt},
|
|
92
|
+
]
|
|
93
|
+
}],
|
|
94
|
+
"images": [image_base64]
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
elif self.args.input_type == 1:
|
|
98
|
+
params = {
|
|
99
|
+
"predictor": self.args.predictor,
|
|
100
|
+
"compressed": self.args.compressed,
|
|
101
|
+
"X": [image_base64]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
r = self.client.predict(params)
|
|
105
|
+
prediction = r[self.args.predictor][0]
|
|
106
|
+
info(prediction)
|
|
107
|
+
self.fps.update()
|
|
108
|
+
|
|
109
|
+
if isinstance(prediction, list) == False and isinstance(prediction, dict) == False:
|
|
110
|
+
cv2.putText(frame, prediction, (10, 100),
|
|
111
|
+
fontFace=cv2.FONT_HERSHEY_SIMPLEX, fontScale=1.3, color=(255, 255, 255), thickness=3
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
with self.lock_frame:
|
|
115
|
+
self.frame = frame
|
|
116
|
+
|
|
117
|
+
def read(self):
|
|
118
|
+
with self.lock_frame:
|
|
119
|
+
return self.frame
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class ScreenDaemon(CaptureBase):
|
|
123
|
+
def __init__(self, src=1, period=0, region=None):
|
|
124
|
+
super().__init__(src=src, tag="screen", period=period)
|
|
125
|
+
self.sct = mss.mss()
|
|
126
|
+
self.monitor = self.sct.monitors[src]
|
|
127
|
+
|
|
128
|
+
if region:
|
|
129
|
+
self.monitor = {
|
|
130
|
+
"left": region[0],
|
|
131
|
+
"top": region[1],
|
|
132
|
+
"width": region[2],
|
|
133
|
+
"height": region[3],
|
|
134
|
+
}
|
|
135
|
+
debug(f"Capturing screen region: {self.monitor}")
|
|
136
|
+
else:
|
|
137
|
+
self.monitor = self.sct.monitors[src]
|
|
138
|
+
debug(f"Capturing full monitor {src}: {self.monitor}")
|
|
139
|
+
|
|
140
|
+
def close(self):
|
|
141
|
+
self.sct.close()
|
|
142
|
+
|
|
143
|
+
def read_frame(self):
|
|
144
|
+
sct_img = self.sct.grab(self.monitor)
|
|
145
|
+
self.frame = np.array(sct_img)
|
|
146
|
+
self.frame = cv2.cvtColor(self.frame, cv2.COLOR_BGRA2BGR)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
if __name__ == '__main__':
|
|
150
|
+
cap = ScreenDaemon(src=1, region=[300,300, 800,800])
|
|
151
|
+
cap.start()
|
|
152
|
+
while(True):
|
|
153
|
+
frame = cap.read()
|
|
154
|
+
frame = cv2.resize(frame, (250, 250))
|
|
155
|
+
cv2.imshow("captured", frame)
|
|
156
|
+
cv2.waitKey(1)
|
|
@@ -19,23 +19,24 @@ from sciveo.tools.simple_counter import RunCounter
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class BaseWatchDogDaemon(DaemonBase):
|
|
22
|
-
def __init__(self, threshold_percent=90, period=5, command="echo '⚠️'", monitored="none"):
|
|
22
|
+
def __init__(self, threshold_percent=90, period=5, command="echo '⚠️'", monitored="none", monitor_value="usage"):
|
|
23
23
|
super().__init__(period=period)
|
|
24
24
|
self.threshold_percent = threshold_percent
|
|
25
25
|
self.command = command
|
|
26
26
|
self.used_percent = 0
|
|
27
27
|
self.monitored = monitored
|
|
28
|
-
self.
|
|
28
|
+
self.monitor_value = monitor_value
|
|
29
|
+
self.printer = RunCounter(60, lambda: debug(f"{self.monitored} {self.monitor_value}: {self.used_percent}%", f"threshold: {self.threshold_percent}%"))
|
|
29
30
|
|
|
30
|
-
def
|
|
31
|
-
return 0.0
|
|
31
|
+
def value(self):
|
|
32
|
+
return {"percent": 0.0}
|
|
32
33
|
|
|
33
34
|
def loop(self):
|
|
34
35
|
current_value = self.value()
|
|
35
36
|
self.used_percent = current_value["percent"]
|
|
36
37
|
self.printer.run()
|
|
37
38
|
if self.used_percent > self.threshold_percent:
|
|
38
|
-
warning(f"⚠️ {self.monitored}
|
|
39
|
+
warning(f"⚠️ {self.monitored} {self.monitor_value} {self.used_percent}% exceeded {self.threshold_percent}%, executing command: {self.command}")
|
|
39
40
|
subprocess.run(self.command, shell=True)
|
|
40
41
|
|
|
41
42
|
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
# 2025
|
|
10
|
+
#
|
|
11
|
+
|
|
12
|
+
import time
|
|
13
|
+
import psutil
|
|
14
|
+
|
|
15
|
+
from sciveo.tools.logger import *
|
|
16
|
+
from sciveo.monitoring.watchdog.base import BaseWatchDogDaemon
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ProcessWatchDogDaemon(BaseWatchDogDaemon):
|
|
20
|
+
def __init__(self, pid=None, process_cmd=None, period=5, command="echo '⚠️ process error!'", thread_inactive_threshold=None):
|
|
21
|
+
self.process_cmd = process_cmd
|
|
22
|
+
self.threads = {}
|
|
23
|
+
self.thread_inactive_threshold = thread_inactive_threshold
|
|
24
|
+
super().__init__(threshold_percent=10, period=period, command=command, monitored="Process", monitor_value="is dead")
|
|
25
|
+
|
|
26
|
+
self.this_pid = psutil.Process().pid
|
|
27
|
+
self.pids = self.get_pids_by_cmd()
|
|
28
|
+
if pid is not None:
|
|
29
|
+
self.pids.append(pid)
|
|
30
|
+
|
|
31
|
+
def get_pids_by_cmd(self):
|
|
32
|
+
matched_pids = []
|
|
33
|
+
if self.process_cmd is not None:
|
|
34
|
+
for proc in psutil.process_iter(attrs=["pid", "cmdline"]):
|
|
35
|
+
if proc.info["pid"] == self.this_pid:
|
|
36
|
+
continue
|
|
37
|
+
try:
|
|
38
|
+
cmdline = " ".join(proc.info["cmdline"])
|
|
39
|
+
if self.process_cmd in cmdline:
|
|
40
|
+
matched_pids.append(proc.info["pid"])
|
|
41
|
+
except Exception:
|
|
42
|
+
continue
|
|
43
|
+
info(f"processes matching [{self.process_cmd}]", matched_pids)
|
|
44
|
+
return matched_pids
|
|
45
|
+
|
|
46
|
+
def get_threads(self, process):
|
|
47
|
+
current_time = time.time()
|
|
48
|
+
for t in process.threads():
|
|
49
|
+
cpu_time = t.user_time + t.system_time
|
|
50
|
+
if t.id not in self.threads:
|
|
51
|
+
self.threads[t.id] = {
|
|
52
|
+
"id": t.id,
|
|
53
|
+
"start_at": current_time,
|
|
54
|
+
"last_active": current_time,
|
|
55
|
+
"last_cpu": cpu_time
|
|
56
|
+
}
|
|
57
|
+
else:
|
|
58
|
+
if cpu_time != self.threads[t.id]["last_cpu"]:
|
|
59
|
+
self.threads[t.id]["last_active"] = current_time
|
|
60
|
+
self.threads[t.id]["last_cpu"] = cpu_time
|
|
61
|
+
|
|
62
|
+
def check_threads(self, pid):
|
|
63
|
+
current_time = time.time()
|
|
64
|
+
for tid, thr in self.threads.items():
|
|
65
|
+
if current_time - thr["last_active"] > self.thread_inactive_threshold:
|
|
66
|
+
warning(f"⚠️ process[{pid}] thread[{tid}] inactive from {thr['last_active']}")
|
|
67
|
+
|
|
68
|
+
def process_value(self, pid):
|
|
69
|
+
try:
|
|
70
|
+
p = psutil.Process(pid)
|
|
71
|
+
if p.is_running():
|
|
72
|
+
if p.status() != psutil.STATUS_ZOMBIE:
|
|
73
|
+
|
|
74
|
+
if self.thread_inactive_threshold is not None:
|
|
75
|
+
try:
|
|
76
|
+
self.get_threads(p)
|
|
77
|
+
self.check_threads()
|
|
78
|
+
except psutil.NoSuchProcess as e:
|
|
79
|
+
exception(e, pid)
|
|
80
|
+
|
|
81
|
+
return 0
|
|
82
|
+
else:
|
|
83
|
+
return 50
|
|
84
|
+
except psutil.NoSuchProcess:
|
|
85
|
+
pass
|
|
86
|
+
return 100
|
|
87
|
+
|
|
88
|
+
def value(self):
|
|
89
|
+
pv = 0.0
|
|
90
|
+
for pid in self.pids:
|
|
91
|
+
pv += self.process_value(pid)
|
|
92
|
+
return {"percent": pv}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == '__main__':
|
|
96
|
+
daemons = [
|
|
97
|
+
ProcessWatchDogDaemon(pid=87443, thread_inactive_threshold=10),
|
|
98
|
+
ProcessWatchDogDaemon(process_cmd="sciveo monitor", thread_inactive_threshold=10),
|
|
99
|
+
]
|
|
100
|
+
for d in daemons:
|
|
101
|
+
d.start()
|
|
102
|
+
|
|
103
|
+
while(True):
|
|
104
|
+
time.sleep(30)
|
|
File without changes
|