matrice 1.0.99241__py3-none-any.whl → 1.0.99242__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.
@@ -257,7 +257,7 @@ class ResultsAggregator:
257
257
 
258
258
  # Check if output queue is getting full
259
259
  queue_size = self.aggregated_results_queue.qsize()
260
- if queue_size > 0:
260
+ if queue_size > 1000:
261
261
  health["status"] = "degraded"
262
262
  health["reason"] = f"Output queue too large ({queue_size} items)"
263
263
  logging.warning(f"Aggregator degraded: output queue has {queue_size} items (threshold: 100)")
@@ -2,7 +2,7 @@ import logging
2
2
  import time
3
3
  import threading
4
4
  from typing import Dict, Optional, List, Tuple
5
- from queue import Empty, PriorityQueue
5
+ from queue import Empty, PriorityQueue, Full
6
6
  from matrice.session import Session
7
7
  from matrice.deploy.utils.kafka_utils import MatriceKafkaDeployment
8
8
  import itertools
@@ -198,7 +198,7 @@ class ResultsIngestor:
198
198
  input_streams = result_value.get("input_streams", [])
199
199
  input_stream = input_streams[0]["input_stream"] if input_streams else {}
200
200
  # input_order = input_stream.get("input_order")
201
- camera_info = input_stream.get("camera_info")
201
+ camera_info = input_stream.get("camera_info") or {}
202
202
  stream_key = camera_info.get("camera_name")
203
203
  stream_group_key = camera_info.get("camera_group") or "default_group"
204
204
 
@@ -229,15 +229,24 @@ class ResultsIngestor:
229
229
  deployment_id
230
230
  ] = results_queue.qsize()
231
231
 
232
- except Exception as exc:
232
+ except Full:
233
233
  # Queue is full, log warning and continue
234
234
  logging.warning(
235
- f"Result queue full for deployment {deployment_id}, dropping result: {exc}"
235
+ f"Result queue full for deployment {deployment_id}, dropping result"
236
236
  )
237
237
  with self._lock:
238
238
  self.stats["errors"] += 1
239
239
  self.stats["last_error"] = "Queue full"
240
240
  self.stats["last_error_time"] = time.time()
241
+ except Exception as exc:
242
+ # Other enqueue errors
243
+ logging.error(
244
+ f"Failed to enqueue result for deployment {deployment_id}: {exc}"
245
+ )
246
+ with self._lock:
247
+ self.stats["errors"] += 1
248
+ self.stats["last_error"] = str(exc)
249
+ self.stats["last_error_time"] = time.time()
241
250
 
242
251
  except Exception as exc:
243
252
  if not self._stop_streaming.is_set():
@@ -36,12 +36,12 @@ class ResultsSynchronizer:
36
36
  self._synchronization_thread = None
37
37
 
38
38
  # Synchronization state
39
- # Structure: {(stream_key, session_id, input_order): {deployment_id: result, ...}}
40
- self._pending_results: Dict[Tuple[str, int, int], Dict[str, Dict]] = defaultdict(
39
+ # Structure: {(stream_group_key, stream_key, input_order): {deployment_id: result, ...}}
40
+ self._pending_results: Dict[Tuple[str, str, int], Dict[str, Dict]] = defaultdict(
41
41
  dict
42
42
  )
43
43
  # Track when each key combination was first seen
44
- self._result_timestamps: Dict[Tuple[str, int, int], float] = {}
44
+ self._result_timestamps: Dict[Tuple[str, str, int], float] = {}
45
45
 
46
46
  # Statistics
47
47
  self.stats = {
@@ -113,7 +113,7 @@ class ResultsSynchronizer:
113
113
 
114
114
  def _create_synchronized_result(
115
115
  self,
116
- key: Tuple[str, int, int],
116
+ key: Tuple[str, str, int],
117
117
  deployment_results: Dict[str, Dict],
118
118
  is_complete: bool,
119
119
  is_timeout: bool,
@@ -204,11 +204,17 @@ class ResultsSynchronizer:
204
204
  # Update statistics
205
205
  if is_complete:
206
206
  self.stats["complete_syncs"] += 1
207
- logging.debug(f"Complete sync for stream {key[0]}, session {key[1]}, order {key[2]} with {len(deployment_results)} deployments")
207
+ stream_group_key, stream_key, input_order = key
208
+ logging.debug(
209
+ f"Complete sync for group {stream_group_key}, stream {stream_key}, "
210
+ f"order {input_order} with {len(deployment_results)} deployments"
211
+ )
208
212
  else:
209
213
  self.stats["partial_syncs"] += 1
214
+ stream_group_key, stream_key, input_order = key
210
215
  logging.warning(
211
- f"Partial sync for stream {key[0]}, session {key[1]}, order {key[2]}: {len(deployment_results)}/{len(self.deployment_ids)} deployments "
216
+ f"Partial sync for group {stream_group_key}, stream {stream_key}, "
217
+ f"order {input_order}: {len(deployment_results)}/{len(self.deployment_ids)} deployments "
212
218
  f"(timeout after {result_age:.2f}s)"
213
219
  )
214
220
 
@@ -230,8 +236,9 @@ class ResultsSynchronizer:
230
236
  self.stats["results_synchronized"] += 1
231
237
 
232
238
  logging.debug(
233
- f"Sent synchronized result for stream {synchronized_result['stream_key']}, "
234
- f"session {synchronized_result['session_id']}, order {synchronized_result['input_order']}"
239
+ f"Sent synchronized result for group {synchronized_result.get('stream_group_key')}, "
240
+ f"stream {synchronized_result['stream_key']}, "
241
+ f"order {synchronized_result['input_order']}"
235
242
  )
236
243
 
237
244
  except Exception as exc:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.99241
3
+ Version: 1.0.99242
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
@@ -93,11 +93,11 @@ matrice/data_processing/data_formats/video_youtube_bb_tracking.py,sha256=6RbuBOW
93
93
  matrice/data_processing/data_formats/yolo_detection.py,sha256=qUeZA7_8Of_QWGZlHh-mhRnBFtb5A_u89Oihx-Meg3c,10018
94
94
  matrice/deploy/__init__.py,sha256=1IEknWS1AxZL4aGzCyASusGH_vMEPk1L6u8RnnZjI9w,1256
95
95
  matrice/deploy/aggregator/__init__.py,sha256=HFz-ufUMeSpSyRINcrx6NdmrcuVZtPfyIXxYu5UNLTc,508
96
- matrice/deploy/aggregator/aggregator.py,sha256=T5S4qLBkCKs_lFaT83AS1dp422mzhty1NmJkGU00KhU,11447
97
- matrice/deploy/aggregator/ingestor.py,sha256=4SwCDvo1ZBwNUJECbHYGcvxGz6U7CSugV5SFmLauBpY,15423
96
+ matrice/deploy/aggregator/aggregator.py,sha256=ob-I9ZaGmhXqdzbIHZL8DDtYCaT944ipmlhFzIz6peQ,11450
97
+ matrice/deploy/aggregator/ingestor.py,sha256=Xb6F5qn693qtF6ku80T6N-KJ76wAqPAtJLsIQgWHbmw,15898
98
98
  matrice/deploy/aggregator/pipeline.py,sha256=xOKDqb4Qre5Ek3Fr-03C-jxpZNXdQ2_Dk5EaOn4ssYE,33948
99
99
  matrice/deploy/aggregator/publisher.py,sha256=SRPnyindD_R_QNK5MJ_WZAeAaGtj79CZ1VNoltsQtXM,15587
100
- matrice/deploy/aggregator/synchronizer.py,sha256=tPFwTWPHnF9c4memBoVB0b6n7v-vvUbdNeWPP4CH6bE,19662
100
+ matrice/deploy/aggregator/synchronizer.py,sha256=8KJwJ9JZ74ok1b7IfMwSYLqgWiyAeMa_z2-NX7LuLqQ,19992
101
101
  matrice/deploy/client/__init__.py,sha256=d7yxlWNHYKOoAM9T_AlrSQw1_9cfLEop4zBE0QqrTVw,1330
102
102
  matrice/deploy/client/client.py,sha256=5itmvupufK48lPNb2__ZbZ9q3Q5ycfCDTW6ClDC7cM4,28531
103
103
  matrice/deploy/client/client_stream_utils.py,sha256=IcJf8Xn8VMrvxplKqSP5qNIwvu8--YSYaN4BCelk-iQ,40006
@@ -242,8 +242,8 @@ matrice/deployment/camera_manager.py,sha256=e1Lc81RJP5wUWRdTgHO6tMWF9BkBdHOSVyx3
242
242
  matrice/deployment/deployment.py,sha256=HFt151eWq6iqIAMsQvurpV2WNxW6Cx_gIUVfnVy5SWE,48093
243
243
  matrice/deployment/inference_pipeline.py,sha256=6b4Mm3-qt-Zy0BeiJfFQdImOn3FzdNCY-7ET7Rp8PMk,37911
244
244
  matrice/deployment/streaming_gateway_manager.py,sha256=ifYGl3g25wyU39HwhPQyI2OgF3M6oIqKMWt8RXtMxY8,21401
245
- matrice-1.0.99241.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
246
- matrice-1.0.99241.dist-info/METADATA,sha256=dQ_fzAottar2md4qqJzOVkqiqvGmK6AfHBw6jVirIsI,14624
247
- matrice-1.0.99241.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
248
- matrice-1.0.99241.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
249
- matrice-1.0.99241.dist-info/RECORD,,
245
+ matrice-1.0.99242.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
246
+ matrice-1.0.99242.dist-info/METADATA,sha256=l8osThgC_or1VtVsMdKYK9recYFQg_ZZLb4D1VdFpbs,14624
247
+ matrice-1.0.99242.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
248
+ matrice-1.0.99242.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
249
+ matrice-1.0.99242.dist-info/RECORD,,