nedo-vision-worker 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
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.
- nedo_vision_worker/__init__.py +1 -1
- nedo_vision_worker/cli.py +1 -1
- nedo_vision_worker/repositories/PPEDetectionRepository.py +2 -0
- nedo_vision_worker/repositories/RestrictedAreaRepository.py +2 -0
- nedo_vision_worker/services/PPEDetectionClient.py +5 -0
- nedo_vision_worker/services/RestrictedAreaClient.py +5 -0
- nedo_vision_worker/worker/CoreActionWorker.py +13 -2
- nedo_vision_worker/worker/PipelineActionWorker.py +13 -2
- nedo_vision_worker/worker/PipelineImageWorker.py +13 -2
- nedo_vision_worker/worker/RabbitMQListener.py +11 -0
- nedo_vision_worker/worker/VideoStreamWorker.py +13 -2
- {nedo_vision_worker-1.0.0.dist-info → nedo_vision_worker-1.1.1.dist-info}/METADATA +1 -1
- {nedo_vision_worker-1.0.0.dist-info → nedo_vision_worker-1.1.1.dist-info}/RECORD +16 -16
- {nedo_vision_worker-1.0.0.dist-info → nedo_vision_worker-1.1.1.dist-info}/WHEEL +0 -0
- {nedo_vision_worker-1.0.0.dist-info → nedo_vision_worker-1.1.1.dist-info}/entry_points.txt +0 -0
- {nedo_vision_worker-1.0.0.dist-info → nedo_vision_worker-1.1.1.dist-info}/top_level.txt +0 -0
nedo_vision_worker/__init__.py
CHANGED
nedo_vision_worker/cli.py
CHANGED
|
@@ -94,6 +94,8 @@ class PPEDetectionRepository:
|
|
|
94
94
|
|
|
95
95
|
# Delete the image file associated with the detection if it exists
|
|
96
96
|
image_path = detection.image_path
|
|
97
|
+
if not os.path.isabs(image_path):
|
|
98
|
+
image_path = str(get_storage_path("files") / Path(image_path).relative_to("data/files"))
|
|
97
99
|
if os.path.exists(image_path):
|
|
98
100
|
os.remove(image_path)
|
|
99
101
|
logging.info(f"Deleted image file: {image_path}")
|
|
@@ -72,6 +72,8 @@ class RestrictedAreaRepository:
|
|
|
72
72
|
|
|
73
73
|
for violation in violations_to_delete:
|
|
74
74
|
image_path = violation.image_path
|
|
75
|
+
if not os.path.isabs(image_path):
|
|
76
|
+
image_path = str(get_storage_path("restricted_violations") / Path(image_path).relative_to("data/restricted_violations"))
|
|
75
77
|
if os.path.exists(image_path):
|
|
76
78
|
os.remove(image_path)
|
|
77
79
|
logging.info(f"Deleted image file: {image_path}")
|
|
@@ -38,6 +38,11 @@ class PPEDetectionClient(GrpcClientBase):
|
|
|
38
38
|
Returns:
|
|
39
39
|
bytes: Binary content of the image.
|
|
40
40
|
"""
|
|
41
|
+
from ..database.DatabaseManager import get_storage_path
|
|
42
|
+
from pathlib import Path
|
|
43
|
+
import os
|
|
44
|
+
if not os.path.isabs(image_path):
|
|
45
|
+
image_path = str(get_storage_path("files") / Path(image_path).relative_to("data/files"))
|
|
41
46
|
with open(image_path, 'rb') as image_file:
|
|
42
47
|
return image_file.read()
|
|
43
48
|
|
|
@@ -39,6 +39,11 @@ class RestrictedAreaClient(GrpcClientBase):
|
|
|
39
39
|
Returns:
|
|
40
40
|
bytes: Binary content of the image.
|
|
41
41
|
"""
|
|
42
|
+
from ..database.DatabaseManager import get_storage_path
|
|
43
|
+
from pathlib import Path
|
|
44
|
+
import os
|
|
45
|
+
if not os.path.isabs(image_path):
|
|
46
|
+
image_path = str(get_storage_path("restricted_violations") / Path(image_path).relative_to("data/restricted_violations"))
|
|
42
47
|
with open(image_path, 'rb') as image_file:
|
|
43
48
|
return image_file.read()
|
|
44
49
|
|
|
@@ -72,12 +72,23 @@ class CoreActionWorker:
|
|
|
72
72
|
"""Main loop to manage RabbitMQ listener."""
|
|
73
73
|
try:
|
|
74
74
|
while not self.stop_event.is_set():
|
|
75
|
-
logger.info("📡 [APP]
|
|
75
|
+
logger.info("📡 [APP] Starting core action message listener...")
|
|
76
76
|
self.listener.start_listening(
|
|
77
77
|
exchange_name="nedo.worker.core.action",
|
|
78
78
|
queue_name=f"nedo.worker.core.{self.worker_id}"
|
|
79
79
|
)
|
|
80
|
-
|
|
80
|
+
|
|
81
|
+
# Wait for the listener thread to finish (connection lost or stop requested)
|
|
82
|
+
while not self.stop_event.is_set() and self.listener.listener_thread and self.listener.listener_thread.is_alive():
|
|
83
|
+
self.listener.listener_thread.join(timeout=5) # Check every 5 seconds
|
|
84
|
+
|
|
85
|
+
if not self.stop_event.is_set():
|
|
86
|
+
logger.warning("⚠️ [APP] Core action listener disconnected. Attempting to reconnect in 10 seconds...")
|
|
87
|
+
self.stop_event.wait(10) # Wait 10 seconds before reconnecting
|
|
88
|
+
else:
|
|
89
|
+
logger.info("📡 [APP] Core action listener stopped.")
|
|
90
|
+
break
|
|
91
|
+
|
|
81
92
|
except Exception as e:
|
|
82
93
|
logger.error("🚨 [APP] Unexpected error in Core Action Worker loop.", exc_info=True)
|
|
83
94
|
|
|
@@ -73,12 +73,23 @@ class PipelineActionWorker:
|
|
|
73
73
|
"""Main loop to manage RabbitMQ listener."""
|
|
74
74
|
try:
|
|
75
75
|
while not self.stop_event.is_set():
|
|
76
|
-
logger.info("📡 [APP]
|
|
76
|
+
logger.info("📡 [APP] Starting pipeline action message listener...")
|
|
77
77
|
self.listener.start_listening(
|
|
78
78
|
exchange_name="nedo.worker.pipeline.action",
|
|
79
79
|
queue_name=f"nedo.worker.pipeline.{self.worker_id}"
|
|
80
80
|
)
|
|
81
|
-
|
|
81
|
+
|
|
82
|
+
# Wait for the listener thread to finish (connection lost or stop requested)
|
|
83
|
+
while not self.stop_event.is_set() and self.listener.listener_thread and self.listener.listener_thread.is_alive():
|
|
84
|
+
self.listener.listener_thread.join(timeout=5) # Check every 5 seconds
|
|
85
|
+
|
|
86
|
+
if not self.stop_event.is_set():
|
|
87
|
+
logger.warning("⚠️ [APP] Pipeline action listener disconnected. Attempting to reconnect in 10 seconds...")
|
|
88
|
+
self.stop_event.wait(10) # Wait 10 seconds before reconnecting
|
|
89
|
+
else:
|
|
90
|
+
logger.info("📡 [APP] Pipeline action listener stopped.")
|
|
91
|
+
break
|
|
92
|
+
|
|
82
93
|
except Exception as e:
|
|
83
94
|
logger.error("🚨 [APP] Unexpected error in Pipeline Action Worker loop.", exc_info=True)
|
|
84
95
|
|
|
@@ -78,9 +78,20 @@ class PipelineImageWorker:
|
|
|
78
78
|
"""Main loop to manage RabbitMQ listener."""
|
|
79
79
|
try:
|
|
80
80
|
while not self.stop_event.is_set():
|
|
81
|
-
logger.info("📡 [APP]
|
|
81
|
+
logger.info("📡 [APP] Starting image request message listener...")
|
|
82
82
|
self.listener.start_listening(exchange_name="nedo.pipeline.image.request", queue_name=f"nedo.pipeline.request.{self.worker_id}")
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
# Wait for the listener thread to finish (connection lost or stop requested)
|
|
85
|
+
while not self.stop_event.is_set() and self.listener.listener_thread and self.listener.listener_thread.is_alive():
|
|
86
|
+
self.listener.listener_thread.join(timeout=5) # Check every 5 seconds
|
|
87
|
+
|
|
88
|
+
if not self.stop_event.is_set():
|
|
89
|
+
logger.warning("⚠️ [APP] Image request listener disconnected. Attempting to reconnect in 10 seconds...")
|
|
90
|
+
self.stop_event.wait(10) # Wait 10 seconds before reconnecting
|
|
91
|
+
else:
|
|
92
|
+
logger.info("📡 [APP] Image request listener stopped.")
|
|
93
|
+
break
|
|
94
|
+
|
|
84
95
|
except Exception as e:
|
|
85
96
|
logger.error("🚨 [APP] Unexpected error in Pipeline Image Worker loop.", exc_info=True)
|
|
86
97
|
|
|
@@ -91,6 +91,10 @@ class RabbitMQListener:
|
|
|
91
91
|
if self.listener_thread and self.listener_thread.is_alive():
|
|
92
92
|
logger.warning("⚠️ [APP] RabbitMQ listener is already running.")
|
|
93
93
|
return
|
|
94
|
+
|
|
95
|
+
# Clean up any dead thread reference
|
|
96
|
+
if self.listener_thread and not self.listener_thread.is_alive():
|
|
97
|
+
self.listener_thread = None
|
|
94
98
|
|
|
95
99
|
def run():
|
|
96
100
|
while not self.stop_event.is_set():
|
|
@@ -137,6 +141,13 @@ class RabbitMQListener:
|
|
|
137
141
|
logger.error(f"🚨 [APP] Error during RabbitMQ shutdown: {e}")
|
|
138
142
|
|
|
139
143
|
self._cleanup_connection()
|
|
144
|
+
|
|
145
|
+
# Clean up the listener thread reference
|
|
146
|
+
if self.listener_thread:
|
|
147
|
+
if self.listener_thread.is_alive():
|
|
148
|
+
self.listener_thread.join(timeout=5) # Wait up to 5 seconds for thread to finish
|
|
149
|
+
self.listener_thread = None
|
|
150
|
+
|
|
140
151
|
logger.info("🔌 [APP] RabbitMQ listener stopped.")
|
|
141
152
|
|
|
142
153
|
def _cleanup_connection(self):
|
|
@@ -80,9 +80,20 @@ class VideoStreamWorker:
|
|
|
80
80
|
"""Main loop to manage RabbitMQ listener."""
|
|
81
81
|
try:
|
|
82
82
|
while not self.stop_event.is_set():
|
|
83
|
-
logger.info("📡 [APP]
|
|
83
|
+
logger.info("📡 [APP] Starting video stream message listener...")
|
|
84
84
|
self.listener.start_listening(exchange_name="nedo.worker.stream.preview", queue_name=f"nedo.worker.preview.{self.worker_id}")
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
# Wait for the listener thread to finish (connection lost or stop requested)
|
|
87
|
+
while not self.stop_event.is_set() and self.listener.listener_thread and self.listener.listener_thread.is_alive():
|
|
88
|
+
self.listener.listener_thread.join(timeout=5) # Check every 5 seconds
|
|
89
|
+
|
|
90
|
+
if not self.stop_event.is_set():
|
|
91
|
+
logger.warning("⚠️ [APP] Video stream listener disconnected. Attempting to reconnect in 10 seconds...")
|
|
92
|
+
self.stop_event.wait(10) # Wait 10 seconds before reconnecting
|
|
93
|
+
else:
|
|
94
|
+
logger.info("📡 [APP] Video stream listener stopped.")
|
|
95
|
+
break
|
|
96
|
+
|
|
86
97
|
except Exception as e:
|
|
87
98
|
logger.error("🚨 [APP] Unexpected error in Stream Worker loop.", exc_info=True)
|
|
88
99
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nedo-vision-worker
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Nedo Vision Worker Service Library for AI Vision Processing
|
|
5
5
|
Author-email: Willy Achmat Fauzi <willy.achmat@gmail.com>
|
|
6
6
|
Maintainer-email: Willy Achmat Fauzi <willy.achmat@gmail.com>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
nedo_vision_worker/__init__.py,sha256=
|
|
2
|
-
nedo_vision_worker/cli.py,sha256=
|
|
1
|
+
nedo_vision_worker/__init__.py,sha256=mgPDe2FHxWQLXYxpyKnft8nCtd1Jkbwb2x1oSn8wV9o,203
|
|
2
|
+
nedo_vision_worker/cli.py,sha256=9NgdpolGqMMkDtg79OxzRgd25jn5iW-nuGL2TI14GB0,6227
|
|
3
3
|
nedo_vision_worker/doctor.py,sha256=dO3eOOauAFrCwj1UX1A-1jj_zsE2Y0UycGqPXaEOKjg,16152
|
|
4
4
|
nedo_vision_worker/worker_service.py,sha256=XLzaN-n8f4ysPcOmJpO51I9_MWuVTnFMJF08sVHT7IA,9882
|
|
5
5
|
nedo_vision_worker/config/ConfigurationManager.py,sha256=QrQaQ9Cdjpkcr2JE_miyrWJIZmMgZwJYBz-wE45Zzes,8011
|
|
@@ -40,8 +40,8 @@ nedo_vision_worker/protos/WorkerSourceService_pb2_grpc.py,sha256=fTxFjgr9gZjx2rI
|
|
|
40
40
|
nedo_vision_worker/protos/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
41
41
|
nedo_vision_worker/repositories/AIModelRepository.py,sha256=35cQ2EnJvMdArewumPrVIaiwueGy6cXU_g5J1Qcj6_Y,1415
|
|
42
42
|
nedo_vision_worker/repositories/DatasetSourceRepository.py,sha256=MOUbXY1-7WUPhY15aMpdXl6rl0afSvu3Cq8jNtp9nzM,8595
|
|
43
|
-
nedo_vision_worker/repositories/PPEDetectionRepository.py,sha256=
|
|
44
|
-
nedo_vision_worker/repositories/RestrictedAreaRepository.py,sha256=
|
|
43
|
+
nedo_vision_worker/repositories/PPEDetectionRepository.py,sha256=oyQjIRyfa0pA-ErVtrKkCLMY521QIbz9ZqSXotC8nqY,4766
|
|
44
|
+
nedo_vision_worker/repositories/RestrictedAreaRepository.py,sha256=y3n2ZfQbth1I_IjVYaT38qpRINQQC_dKeTf0yHPFNjw,3724
|
|
45
45
|
nedo_vision_worker/repositories/WorkerSourcePipelineDebugRepository.py,sha256=kOlVEnPOoDRZdZIm8uWXlc89GMvBPI-36QyKecX7ucE,3350
|
|
46
46
|
nedo_vision_worker/repositories/WorkerSourcePipelineDetectionRepository.py,sha256=cbgg_7p0eNUIgCHoPDZBaRZ1b2Y68p_dfSxpvuGMtRE,1773
|
|
47
47
|
nedo_vision_worker/repositories/WorkerSourcePipelineRepository.py,sha256=xfmEvgnyt-DdfSApGyFfy0H0dXjFFkjeo4LMr0fVFXU,10053
|
|
@@ -54,9 +54,9 @@ nedo_vision_worker/services/FileToRTMPServer.py,sha256=yUJxrouoTLSq9XZ88dhDYhP-p
|
|
|
54
54
|
nedo_vision_worker/services/GrpcClientBase.py,sha256=zEqDglS48HmcLw77LWc7l6nLYeVy_w_6y2O5pB9C88A,6344
|
|
55
55
|
nedo_vision_worker/services/GrpcClientManager.py,sha256=DLXekmxlQogLo8V9-TNDXtyHT_UG-BaggqwsIups55k,5568
|
|
56
56
|
nedo_vision_worker/services/ImageUploadClient.py,sha256=T353YsRfm74G7Mh-eWr5nvdQHXTfpKwHJFmNW8HyjT8,3019
|
|
57
|
-
nedo_vision_worker/services/PPEDetectionClient.py,sha256=
|
|
57
|
+
nedo_vision_worker/services/PPEDetectionClient.py,sha256=gX2EC4NBkKX5EvqQ8r7pAsaFTiKrl9x6hXA5OVrumt4,4625
|
|
58
58
|
nedo_vision_worker/services/RTSPtoRTMPStreamer.py,sha256=hkPRX6iGxUtivsOA36JWBopHEd1RlmgIP8SLqN4d2TU,3863
|
|
59
|
-
nedo_vision_worker/services/RestrictedAreaClient.py,sha256
|
|
59
|
+
nedo_vision_worker/services/RestrictedAreaClient.py,sha256=-E1Ao_Pxi1DKFWDTotvyXPDgyvxbGox3wwWxKcVaXA8,4143
|
|
60
60
|
nedo_vision_worker/services/SystemUsageClient.py,sha256=PbRuwDWKnMarcnkGtOKfYB5nA-3DeKv7V5_hZr8EDEo,3200
|
|
61
61
|
nedo_vision_worker/services/VideoStreamClient.py,sha256=0PImMGwbPsX0Wfb4wsA42-Qbo8it0aWI-FpQSEV3f_A,6322
|
|
62
62
|
nedo_vision_worker/services/WorkerSourceClient.py,sha256=pSbcPLNlnUERtHE9HyKoYtiptulcQ_DPkygKq-9Qm0M,9186
|
|
@@ -71,22 +71,22 @@ nedo_vision_worker/util/PlatformDetector.py,sha256=-iLPrKs7hp_oltkCI3hESJQkC2uRy
|
|
|
71
71
|
nedo_vision_worker/util/SystemMonitor.py,sha256=2MWYaEXoL91UANT_-SuDWrFMq1ajPorh8co6Py9PV_c,11300
|
|
72
72
|
nedo_vision_worker/util/VideoProbeUtil.py,sha256=r5P6-ecyrSlzJ7W05LrcfdMHlFKb6vg7asowNh1CJrE,4313
|
|
73
73
|
nedo_vision_worker/util/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
74
|
-
nedo_vision_worker/worker/CoreActionWorker.py,sha256=
|
|
74
|
+
nedo_vision_worker/worker/CoreActionWorker.py,sha256=lb7zPY3yui6I3F4rX4Ii7JwpWZahLEO72rh3iWOgFmg,5441
|
|
75
75
|
nedo_vision_worker/worker/DataSenderWorker.py,sha256=o32MT28EqYwAPmd9NKhX3rfNlDKekNOI2n8mZ6s8CpU,7162
|
|
76
76
|
nedo_vision_worker/worker/DataSyncWorker.py,sha256=2qkwef5cFfAZZa2lB5YZLkFVPselR3zdaaLXIBT7NEQ,6216
|
|
77
77
|
nedo_vision_worker/worker/DatasetFrameSender.py,sha256=1SFYj8LJFNi-anBTapsbq8U_NGMM7mnoMKg9NeFAHys,8087
|
|
78
78
|
nedo_vision_worker/worker/DatasetFrameWorker.py,sha256=Ni5gPeDPk9Rz4_cbg63u7Y6LVw_-Bz24OvfeY-6Yp44,19320
|
|
79
79
|
nedo_vision_worker/worker/PPEDetectionManager.py,sha256=fAolWlrsY5SQAWygvjNBNU56IlC0HLlhPgpz7shL-gk,3588
|
|
80
|
-
nedo_vision_worker/worker/PipelineActionWorker.py,sha256=
|
|
81
|
-
nedo_vision_worker/worker/PipelineImageWorker.py,sha256
|
|
82
|
-
nedo_vision_worker/worker/RabbitMQListener.py,sha256=
|
|
80
|
+
nedo_vision_worker/worker/PipelineActionWorker.py,sha256=xgvryjKtEsMj4BKqWzDIaK_lFny-DfMCj5Y2DxHnWww,5651
|
|
81
|
+
nedo_vision_worker/worker/PipelineImageWorker.py,sha256=TN3r8WpgXg7K8knWf9y-3g1q1h-O-zDtxsxr0n2XVzI,5615
|
|
82
|
+
nedo_vision_worker/worker/RabbitMQListener.py,sha256=9gR49MDplgpyb-D5HOH0K77-DJQFvhS2E7biL92SjSU,6950
|
|
83
83
|
nedo_vision_worker/worker/RestrictedAreaManager.py,sha256=3yoXgQ459tV1bOa5choEzR9gE6LklrtHR_e0472U3L0,3521
|
|
84
84
|
nedo_vision_worker/worker/SystemUsageManager.py,sha256=StutV4UyLUfduYfK20de4SbPd7wqkR7io0gsOajxWSU,4509
|
|
85
|
-
nedo_vision_worker/worker/VideoStreamWorker.py,sha256=
|
|
85
|
+
nedo_vision_worker/worker/VideoStreamWorker.py,sha256=TxoMYoaU6IcwJDLILC71WUkYahqVAnNX05_5qPbeS_8,6514
|
|
86
86
|
nedo_vision_worker/worker/WorkerManager.py,sha256=7G8ORHpcVAb73UbTUi2WhcQJ-A1XFSq9d_9dLxABHac,6357
|
|
87
87
|
nedo_vision_worker/worker/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
|
88
|
-
nedo_vision_worker-1.
|
|
89
|
-
nedo_vision_worker-1.
|
|
90
|
-
nedo_vision_worker-1.
|
|
91
|
-
nedo_vision_worker-1.
|
|
92
|
-
nedo_vision_worker-1.
|
|
88
|
+
nedo_vision_worker-1.1.1.dist-info/METADATA,sha256=NsS4IUwJP_PRvuEMzT8o2EQRny_tGAEoYxOXn0iiz2k,14642
|
|
89
|
+
nedo_vision_worker-1.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
90
|
+
nedo_vision_worker-1.1.1.dist-info/entry_points.txt,sha256=LrglS-8nCi8C_PL_pa6uxdgCe879hBETHDVXAckvs-8,60
|
|
91
|
+
nedo_vision_worker-1.1.1.dist-info/top_level.txt,sha256=vgilhlkyD34YsEKkaBabmhIpcKSvF3XpzD2By68L-XI,19
|
|
92
|
+
nedo_vision_worker-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|