matrice-inference 0.1.0__py3-none-manylinux_2_17_x86_64.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.

Potentially problematic release.


This version of matrice-inference might be problematic. Click here for more details.

Files changed (80) hide show
  1. matrice_inference/deploy/aggregator/aggregator.cpython-312-x86_64-linux-gnu.so +0 -0
  2. matrice_inference/deploy/aggregator/aggregator.pyi +55 -0
  3. matrice_inference/deploy/aggregator/analytics.cpython-312-x86_64-linux-gnu.so +0 -0
  4. matrice_inference/deploy/aggregator/analytics.pyi +63 -0
  5. matrice_inference/deploy/aggregator/ingestor.cpython-312-x86_64-linux-gnu.so +0 -0
  6. matrice_inference/deploy/aggregator/ingestor.pyi +79 -0
  7. matrice_inference/deploy/aggregator/pipeline.cpython-312-x86_64-linux-gnu.so +0 -0
  8. matrice_inference/deploy/aggregator/pipeline.pyi +139 -0
  9. matrice_inference/deploy/aggregator/publisher.cpython-312-x86_64-linux-gnu.so +0 -0
  10. matrice_inference/deploy/aggregator/publisher.pyi +59 -0
  11. matrice_inference/deploy/aggregator/synchronizer.cpython-312-x86_64-linux-gnu.so +0 -0
  12. matrice_inference/deploy/aggregator/synchronizer.pyi +58 -0
  13. matrice_inference/deploy/client/auto_streaming/auto_streaming.cpython-312-x86_64-linux-gnu.so +0 -0
  14. matrice_inference/deploy/client/auto_streaming/auto_streaming.pyi +145 -0
  15. matrice_inference/deploy/client/auto_streaming/auto_streaming_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  16. matrice_inference/deploy/client/auto_streaming/auto_streaming_utils.pyi +126 -0
  17. matrice_inference/deploy/client/client.cpython-312-x86_64-linux-gnu.so +0 -0
  18. matrice_inference/deploy/client/client.pyi +337 -0
  19. matrice_inference/deploy/client/client_stream_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  20. matrice_inference/deploy/client/client_stream_utils.pyi +83 -0
  21. matrice_inference/deploy/client/client_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  22. matrice_inference/deploy/client/client_utils.pyi +77 -0
  23. matrice_inference/deploy/client/streaming_gateway/streaming_gateway.cpython-312-x86_64-linux-gnu.so +0 -0
  24. matrice_inference/deploy/client/streaming_gateway/streaming_gateway.pyi +120 -0
  25. matrice_inference/deploy/client/streaming_gateway/streaming_gateway_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  26. matrice_inference/deploy/client/streaming_gateway/streaming_gateway_utils.pyi +442 -0
  27. matrice_inference/deploy/client/streaming_gateway/streaming_results_handler.cpython-312-x86_64-linux-gnu.so +0 -0
  28. matrice_inference/deploy/client/streaming_gateway/streaming_results_handler.pyi +19 -0
  29. matrice_inference/deploy/optimize/cache_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  30. matrice_inference/deploy/optimize/cache_manager.pyi +15 -0
  31. matrice_inference/deploy/optimize/frame_comparators.cpython-312-x86_64-linux-gnu.so +0 -0
  32. matrice_inference/deploy/optimize/frame_comparators.pyi +203 -0
  33. matrice_inference/deploy/optimize/frame_difference.cpython-312-x86_64-linux-gnu.so +0 -0
  34. matrice_inference/deploy/optimize/frame_difference.pyi +165 -0
  35. matrice_inference/deploy/optimize/transmission.cpython-312-x86_64-linux-gnu.so +0 -0
  36. matrice_inference/deploy/optimize/transmission.pyi +97 -0
  37. matrice_inference/deploy/server/inference/batch_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  38. matrice_inference/deploy/server/inference/batch_manager.pyi +50 -0
  39. matrice_inference/deploy/server/inference/inference_interface.cpython-312-x86_64-linux-gnu.so +0 -0
  40. matrice_inference/deploy/server/inference/inference_interface.pyi +114 -0
  41. matrice_inference/deploy/server/inference/model_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  42. matrice_inference/deploy/server/inference/model_manager.pyi +80 -0
  43. matrice_inference/deploy/server/inference/triton_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  44. matrice_inference/deploy/server/inference/triton_utils.pyi +115 -0
  45. matrice_inference/deploy/server/proxy/proxy_interface.cpython-312-x86_64-linux-gnu.so +0 -0
  46. matrice_inference/deploy/server/proxy/proxy_interface.pyi +90 -0
  47. matrice_inference/deploy/server/proxy/proxy_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  48. matrice_inference/deploy/server/proxy/proxy_utils.pyi +113 -0
  49. matrice_inference/deploy/server/server.cpython-312-x86_64-linux-gnu.so +0 -0
  50. matrice_inference/deploy/server/server.pyi +155 -0
  51. matrice_inference/deploy/server/stream/inference_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  52. matrice_inference/deploy/server/stream/inference_worker.pyi +56 -0
  53. matrice_inference/deploy/server/stream/kafka_consumer_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  54. matrice_inference/deploy/server/stream/kafka_consumer_worker.pyi +51 -0
  55. matrice_inference/deploy/server/stream/kafka_producer_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  56. matrice_inference/deploy/server/stream/kafka_producer_worker.pyi +50 -0
  57. matrice_inference/deploy/server/stream/stream_debug_logger.cpython-312-x86_64-linux-gnu.so +0 -0
  58. matrice_inference/deploy/server/stream/stream_debug_logger.pyi +47 -0
  59. matrice_inference/deploy/server/stream/stream_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  60. matrice_inference/deploy/server/stream/stream_manager.pyi +69 -0
  61. matrice_inference/deploy/server/stream/video_buffer.cpython-312-x86_64-linux-gnu.so +0 -0
  62. matrice_inference/deploy/server/stream/video_buffer.pyi +120 -0
  63. matrice_inference/deploy/stream/kafka_stream.cpython-312-x86_64-linux-gnu.so +0 -0
  64. matrice_inference/deploy/stream/kafka_stream.pyi +444 -0
  65. matrice_inference/deploy/stream/redis_stream.cpython-312-x86_64-linux-gnu.so +0 -0
  66. matrice_inference/deploy/stream/redis_stream.pyi +447 -0
  67. matrice_inference/deployment/camera_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  68. matrice_inference/deployment/camera_manager.pyi +669 -0
  69. matrice_inference/deployment/deployment.cpython-312-x86_64-linux-gnu.so +0 -0
  70. matrice_inference/deployment/deployment.pyi +736 -0
  71. matrice_inference/deployment/inference_pipeline.cpython-312-x86_64-linux-gnu.so +0 -0
  72. matrice_inference/deployment/inference_pipeline.pyi +527 -0
  73. matrice_inference/deployment/streaming_gateway_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  74. matrice_inference/deployment/streaming_gateway_manager.pyi +275 -0
  75. matrice_inference/py.typed +0 -0
  76. matrice_inference-0.1.0.dist-info/METADATA +26 -0
  77. matrice_inference-0.1.0.dist-info/RECORD +80 -0
  78. matrice_inference-0.1.0.dist-info/WHEEL +5 -0
  79. matrice_inference-0.1.0.dist-info/licenses/LICENSE.txt +21 -0
  80. matrice_inference-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,80 @@
1
+ """Auto-generated stub for module: model_manager."""
2
+ from typing import Any, Tuple
3
+
4
+ import gc
5
+ import logging
6
+ import torch
7
+
8
+ # Classes
9
+ class ModelManager:
10
+ """
11
+ Minimal ModelManager that focuses on model lifecycle and prediction calls.
12
+ """
13
+
14
+ def __init__(self: Any, model_id: str, internal_server_type: str, internal_port: int, internal_host: str, load_model: Any = None, predict: Any = None, batch_predict: Any = None, action_tracker: Any = None, num_model_instances: int = 1) -> None: ...
15
+ """
16
+ Initialize the ModelManager
17
+
18
+ Args:
19
+ model_id: ID of the model
20
+ internal_server_type: Type of internal server
21
+ internal_port: Internal port number
22
+ internal_host: Internal host address
23
+ load_model: Function to load the model
24
+ predict: Function to run predictions
25
+ batch_predict: Function to run batch predictions
26
+ action_tracker: Tracker for monitoring actions
27
+ num_model_instances: Number of model instances to create
28
+ """
29
+
30
+ def batch_inference(self: Any, input1: Any, input2: Any = None, extra_params: Any = None, stream_key: Any = None, stream_info: Any = None, input_hash: Any = None) -> Tuple[dict, bool]: ...
31
+ """
32
+ Run batch inference on the provided input data.
33
+
34
+ Args:
35
+ input1: Primary input data
36
+ input2: Secondary input data (optional)
37
+ extra_params: Additional parameters for inference (optional)
38
+ stream_key: Stream key for the inference
39
+ stream_info: Stream info for the inference
40
+ input_hash: Input hash for the inference
41
+ Returns:
42
+ Tuple of (results, success_flag)
43
+
44
+ Raises:
45
+ ValueError: If input data is invalid
46
+ """
47
+
48
+ def get_model(self: Any) -> Any: ...
49
+ """
50
+ Get the model instance in round-robin fashion
51
+ """
52
+
53
+ def inference(self: Any, input1: Any, input2: Any = None, extra_params: Any = None, stream_key: Any = None, stream_info: Any = None, input_hash: Any = None) -> Tuple[dict, bool]: ...
54
+ """
55
+ Run inference on the provided input data.
56
+
57
+ Args:
58
+ input1: Primary input data (can be image bytes or numpy array)
59
+ input2: Secondary input data (optional)
60
+ extra_params: Additional parameters for inference (optional)
61
+ stream_key: Stream key for the inference
62
+ stream_info: Stream info for the inference
63
+ input_hash: Input hash for the inference
64
+ Returns:
65
+ Tuple of (results, success_flag)
66
+
67
+ Raises:
68
+ ValueError: If input data is invalid
69
+ """
70
+
71
+ def scale_down(self: Any) -> Any: ...
72
+ """
73
+ Unload the model from memory (scale down)
74
+ """
75
+
76
+ def scale_up(self: Any) -> Any: ...
77
+ """
78
+ Load the model into memory (scale up)
79
+ """
80
+
@@ -0,0 +1,115 @@
1
+ """Auto-generated stub for module: triton_utils."""
2
+ from typing import Any, Dict, Optional, Union
3
+
4
+ from PIL import Image
5
+ from datetime import datetime, timezone
6
+ from io import BytesIO
7
+ from matrice.docker_utils import pull_docker_image
8
+ from matrice_common.utils import dependencies_check
9
+ from matrice_common.utils import dependencies_check
10
+ import httpx
11
+ import logging
12
+ import logging
13
+ import numpy as np
14
+ import os
15
+ import shlex
16
+ import subprocess
17
+ import threading
18
+ import torch
19
+ import torch
20
+ import tritonclient.grpc as tritonclientclass
21
+ import tritonclient.http as tritonclientclass
22
+ import zipfile
23
+
24
+ # Constants
25
+ BASE_PATH: str
26
+ TRITON_DOCKER_IMAGE: str
27
+
28
+ # Classes
29
+ class MatriceTritonServer:
30
+ def __init__(self: Any, action_tracker: Any) -> None: ...
31
+
32
+ def check_triton_docker_image(self: Any) -> Any: ...
33
+ """
34
+ Check if docker image download is complete and wait for it to finish
35
+ """
36
+
37
+ def create_model_repository(self: Any) -> Any: ...
38
+ """
39
+ Create the model repository directory structure
40
+ """
41
+
42
+ def download_model(self: Any, model_version_dir: Any) -> Any: ...
43
+ """
44
+ Download and extract the model files
45
+ """
46
+
47
+ def get_config_params(self: Any) -> Any: ...
48
+
49
+ def setup(self: Any) -> Any: ...
50
+
51
+ def start_server(self: Any) -> Any: ...
52
+ """
53
+ Start the Triton Inference Server
54
+ """
55
+
56
+ def write_config_file(self: Any, model_dir: Any, max_batch_size: Any = 0, num_model_instances: Any = 1, image_size: Any = [224, 224], num_classes: Any = 10, input_data_type: str = 'TYPE_FP32', output_data_type: str = 'TYPE_FP32', dynamic_batching: bool = False, preferred_batch_size: list = [2, 4, 8], max_queue_delay_microseconds: int = 100, input_pinned_memory: bool = True, output_pinned_memory: bool = True, **kwargs: Any) -> Any: ...
57
+ """
58
+ Write the model configuration file for Triton Inference Server
59
+ """
60
+
61
+ class TritonInference:
62
+ """
63
+ Class for making Triton inference requests.
64
+ """
65
+
66
+ def __init__(self: Any, server_type: str, model_id: str, internal_port: int = 80, internal_host: str = 'localhost') -> None: ...
67
+ """
68
+ Initialize Triton inference client.
69
+
70
+ Args:
71
+ server_type: Type of server (grpc/rest)
72
+ model_id: ID of model to use
73
+ internal_port: Port number for internal API
74
+ internal_host: Hostname for internal API
75
+ """
76
+
77
+ async def async_inference(self: Any, input_data: Any) -> Any: ...
78
+ """
79
+ Make an asynchronous inference request.
80
+
81
+ Args:
82
+ input_data: Input data as bytes
83
+
84
+ Returns:
85
+ Model prediction as numpy array
86
+
87
+ Raises:
88
+ Exception: If inference fails
89
+ """
90
+
91
+ def format_response(self: Any, response: Any) -> Dict[str, Any]: ...
92
+ """
93
+ Format model response for consistent logging.
94
+
95
+ Args:
96
+ response: Raw model output
97
+
98
+ Returns:
99
+ Formatted response dictionary
100
+ """
101
+
102
+ def inference(self: Any, input_data: Any) -> Any: ...
103
+ """
104
+ Make a synchronous inference request.
105
+
106
+ Args:
107
+ input_data: Input data as bytes
108
+
109
+ Returns:
110
+ Model prediction as numpy array
111
+
112
+ Raises:
113
+ Exception: If inference fails
114
+ """
115
+
@@ -0,0 +1,90 @@
1
+ """Auto-generated stub for module: proxy_interface."""
2
+ from typing import Any, Optional
3
+
4
+ from contextlib import asynccontextmanager
5
+ from datetime import datetime, timezone
6
+ from fastapi import FastAPI, HTTPException, UploadFile
7
+ from fastapi.encoders import jsonable_encoder
8
+ from fastapi.params import File, Form
9
+ from fastapi.responses import JSONResponse
10
+ from matrice_inference.deploy.server.inference.inference_interface import InferenceInterface
11
+ from matrice_inference.deploy.server.proxy.proxy_utils import AuthKeyValidator, RequestsLogger
12
+ import asyncio
13
+ import httpx
14
+ import logging
15
+ import threading
16
+ import time
17
+ import uvicorn
18
+
19
+ # Classes
20
+ class MatriceProxyInterface:
21
+ """
22
+ Interface for proxying requests to model servers.
23
+ """
24
+
25
+ def __init__(self: Any, session: Any, deployment_id: str, deployment_instance_id: str, external_port: int, inference_interface: Any) -> None: ...
26
+ """
27
+ Initialize proxy server.
28
+
29
+ Args:
30
+ session: Session object for authentication and RPC
31
+ deployment_id: ID of the deployment
32
+ external_port: Port to expose externally
33
+ """
34
+
35
+ async def inference(self: Any, input1: Any, input2: Any = None, extra_params: Any = None, apply_post_processing: Any = False) -> Any: ...
36
+ """
37
+ Perform inference using the inference interface.
38
+
39
+ Args:
40
+ input1: Primary input data
41
+ input2: Secondary input data (optional)
42
+ extra_params: Additional parameters for inference (optional)
43
+ apply_post_processing: Flag to apply post-processing
44
+
45
+ Returns:
46
+ Inference result, Post-processing result
47
+ """
48
+
49
+ def log_prediction_info(self: Any, result: Any, start_time: Any, input1: Any, auth_key: Any) -> Any: ...
50
+ """
51
+ Log prediction info.
52
+
53
+ Args:
54
+ result: Prediction result
55
+ start_time: Start time of the request
56
+ input1: Input data
57
+ auth _key: Authentication key used
58
+ """
59
+
60
+ def on_start(self: Any) -> Any: ...
61
+ """
62
+ Start the proxy server components.
63
+ """
64
+
65
+ async def on_stop(self: Any) -> Any: ...
66
+ """
67
+ Clean up proxy server components.
68
+ """
69
+
70
+ def start(self: Any) -> Any: ...
71
+ """
72
+ Start the proxy server in a background thread.
73
+ """
74
+
75
+ def stop(self: Any) -> Any: ...
76
+ """
77
+ Stop the proxy server gracefully.
78
+ """
79
+
80
+ def validate_auth_key(self: Any, auth_key: Any) -> Any: ...
81
+ """
82
+ Validate auth key.
83
+
84
+ Args:
85
+ auth_key: Authentication key to validate
86
+
87
+ Returns:
88
+ bool: True if valid, False otherwise
89
+ """
90
+
@@ -0,0 +1,113 @@
1
+ """Auto-generated stub for module: proxy_utils."""
2
+ from typing import Any, Dict, Set
3
+
4
+ from datetime import datetime
5
+ from queue import Queue
6
+ import logging
7
+ import numpy as np
8
+ import requests
9
+ import threading
10
+ import time
11
+
12
+ # Classes
13
+ class AuthKeyValidator:
14
+ """
15
+ Validates authentication keys for deployments.
16
+ """
17
+
18
+ def __init__(self: Any, deployment_id: str, session: Any) -> None: ...
19
+ """
20
+ Initialize the AuthKeyValidator.
21
+
22
+ Args:
23
+ deployment_id: ID of the deployment
24
+ session: Session object containing RPC client
25
+ """
26
+
27
+ def start(self: Any) -> None: ...
28
+ """
29
+ Start the auth key update loop in a background thread.
30
+ """
31
+
32
+ def stop(self: Any) -> None: ...
33
+ """
34
+ Stop the auth key update loop.
35
+ """
36
+
37
+ def update_auth_keys(self: Any) -> None: ...
38
+ """
39
+ Fetch and validate auth keys for the deployment.
40
+ """
41
+
42
+ def update_auth_keys_loop(self: Any) -> None: ...
43
+ """
44
+ Run continuous loop to update auth keys.
45
+ """
46
+
47
+ class RequestsLogger:
48
+ """
49
+ Logs prediction requests and handles drift monitoring.
50
+ """
51
+
52
+ def __init__(self: Any, deployment_id: str, session: Any) -> None: ...
53
+ """
54
+ Initialize the RequestsLogger.
55
+
56
+ Args:
57
+ deployment_id: ID of the deployment
58
+ session: Session object containing RPC client
59
+ """
60
+
61
+ def add_log_to_queue(self: Any, prediction: Any, latency: float, request_time: str, input_data: Any, deployment_instance_id: str, auth_key: str) -> None: ...
62
+ """
63
+ Add prediction log to queue for async processing.
64
+
65
+ Args:
66
+ prediction: The model prediction
67
+ latency: Request latency in seconds
68
+ request_time: Timestamp of the request
69
+ input_data: Raw input data bytes
70
+ deployment_instance_id: ID of deployment instance
71
+ auth_key: Authentication key used
72
+ """
73
+
74
+ def log_prediction_info(self: Any, prediction: Any, latency: float, request_time: str, input_data: Any, deployment_instance_id: str, auth_key: str) -> Dict: ...
75
+ """
76
+ Log prediction information to the server.
77
+
78
+ Args:
79
+ prediction: The model prediction
80
+ latency: Request latency in seconds
81
+ request_time: Timestamp of the request
82
+ input_data: Raw input data bytes
83
+ deployment_instance_id: ID of deployment instance
84
+ auth_key: Authentication key used
85
+
86
+ Returns:
87
+ Dict: Response from logging endpoint
88
+ """
89
+
90
+ def log_prediction_info_thread(self: Any) -> None: ...
91
+ """
92
+ Background thread for processing prediction logs.
93
+ """
94
+
95
+ def start(self: Any) -> None: ...
96
+ """
97
+ Start the prediction logging thread.
98
+ """
99
+
100
+ def stop(self: Any) -> None: ...
101
+ """
102
+ Stop the prediction logging thread.
103
+ """
104
+
105
+ def upload_input_for_drift_monitoring(self: Any, log_response: Dict, input_data: Any) -> None: ...
106
+ """
107
+ Upload input data for drift monitoring.
108
+
109
+ Args:
110
+ log_response: Response from logging endpoint
111
+ input_data: Raw input data bytes
112
+ """
113
+
@@ -0,0 +1,155 @@
1
+ """Auto-generated stub for module: server."""
2
+ from typing import Any, Optional
3
+
4
+ from datetime import datetime, timezone
5
+ from matrice.action_tracker import ActionTracker
6
+ from matrice_inference.deploy.server.inference.inference_interface import InferenceInterface
7
+ from matrice_inference.deploy.server.inference.model_manager import ModelManager
8
+ from matrice_inference.deploy.server.proxy.proxy_interface import MatriceProxyInterface
9
+ from matrice_inference.deploy.server.stream.stream_manager import StreamManager
10
+ import asyncio
11
+ import atexit
12
+ import logging
13
+ import os
14
+ import signal
15
+ import threading
16
+ import time
17
+ import urllib.request
18
+
19
+ # Constants
20
+ CLEANUP_DELAY_SECONDS: int
21
+ DEFAULT_EXTERNAL_PORT: int
22
+ DEFAULT_SHUTDOWN_THRESHOLD_MINUTES: int
23
+ FINAL_CLEANUP_DELAY_SECONDS: int
24
+ HEARTBEAT_INTERVAL_SECONDS: int
25
+ IP_FETCH_TIMEOUT_SECONDS: int
26
+ MAX_DEPLOYMENT_CHECK_FAILURES_BEFORE_SHUTDOWN: int
27
+ MAX_HEARTBEAT_FAILURES_BEFORE_SHUTDOWN: int
28
+ MAX_IP_FETCH_ATTEMPTS: int
29
+ MIN_SHUTDOWN_THRESHOLD_MINUTES: int
30
+ SHUTDOWN_CHECK_INTERVAL_SECONDS: int
31
+
32
+ # Classes
33
+ class MatriceDeployServer:
34
+ """
35
+ Class for managing model deployment and server functionality.
36
+ """
37
+
38
+ def __init__(self: Any, load_model: Optional[Callable] = None, predict: Optional[Callable] = None, action_id: str = '', external_port: int = DEFAULT_EXTERNAL_PORT, batch_predict: Optional[Callable] = None, custom_post_processing_fn: Optional[Callable] = None) -> None: ...
39
+ """
40
+ Initialize MatriceDeploy.
41
+
42
+ Args:
43
+ load_model (callable, optional): Function to load model. Defaults to None.
44
+ predict (callable, optional): Function to make predictions. Defaults to None.
45
+ batch_predict (callable, optional): Function to make batch predictions. Defaults to None.
46
+ custom_post_processing_fn (callable, optional): Function to get custom post processing config. Defaults to None.
47
+ action_id (str, optional): ID for action tracking. Defaults to "".
48
+ external_port (int, optional): External port number. Defaults to 80.
49
+
50
+ Raises:
51
+ ValueError: If required parameters are invalid
52
+ Exception: If initialization fails
53
+ """
54
+
55
+ def start(self: Any, block: Any = True) -> Any: ...
56
+ """
57
+ Start the proxy interface and all server components.
58
+ """
59
+
60
+ def start_server(self: Any, block: Any = True) -> Any: ...
61
+ """
62
+ Start the server and related components.
63
+
64
+ Args:
65
+ block: If True, wait for shutdown signal. If False, return immediately after starting.
66
+
67
+ Raises:
68
+ Exception: If unable to initialize server
69
+ """
70
+
71
+ def stop_server(self: Any) -> Any: ...
72
+ """
73
+ Stop the server and related components.
74
+ """
75
+
76
+ class MatriceDeployServerUtils:
77
+ """
78
+ Utility class for managing deployment server operations.
79
+ """
80
+
81
+ def __init__(self: Any, action_tracker: Any, inference_interface: Any, external_port: int, main_server: Any = None) -> None: ...
82
+ """
83
+ Initialize utils with reference to the main server.
84
+
85
+ Args:
86
+ action_tracker: ActionTracker instance
87
+ inference_interface: InferenceInterface instance
88
+ external_port: External port number
89
+ main_server: Reference to the main MatriceDeployServer instance
90
+ """
91
+
92
+ def get_elapsed_time_since_latest_inference(self: Any) -> Any: ...
93
+ """
94
+ Get time elapsed since latest inference.
95
+
96
+ Returns:
97
+ float: Elapsed time in seconds
98
+
99
+ Raises:
100
+ Exception: If unable to get elapsed time and no fallback available
101
+ """
102
+
103
+ def heartbeat_checker(self: Any) -> Any: ...
104
+ """
105
+ Background thread to periodically send heartbeat.
106
+ """
107
+
108
+ def ip(self: Any) -> Any: ...
109
+ """
110
+ Get the external IP address with caching and retry logic.
111
+ """
112
+
113
+ def is_instance_running(self: Any) -> Any: ...
114
+ """
115
+ Check if deployment instance is running.
116
+
117
+ Returns:
118
+ bool: True if instance is running, False otherwise
119
+ """
120
+
121
+ def run_background_checkers(self: Any) -> Any: ...
122
+ """
123
+ Start the shutdown checker and heartbeat checker threads as daemons.
124
+ """
125
+
126
+ def shutdown(self: Any) -> Any: ...
127
+ """
128
+ Gracefully shutdown the deployment instance.
129
+ """
130
+
131
+ def shutdown_checker(self: Any) -> Any: ...
132
+ """
133
+ Background thread to periodically check for idle shutdown condition and deployment status.
134
+ """
135
+
136
+ def trigger_shutdown_if_needed(self: Any) -> Any: ...
137
+ """
138
+ Check idle time and trigger shutdown if threshold exceeded.
139
+ """
140
+
141
+ def update_deployment_address(self: Any) -> Any: ...
142
+ """
143
+ Update the deployment address in the backend.
144
+
145
+ Raises:
146
+ Exception: If unable to update deployment address
147
+ """
148
+
149
+ def wait_for_shutdown(self: Any) -> Any: ...
150
+ """
151
+ Wait for shutdown to be initiated by background checkers or external signals.
152
+
153
+ This method blocks the main thread until shutdown is triggered.
154
+ """
155
+
@@ -0,0 +1,56 @@
1
+ """Auto-generated stub for module: inference_worker."""
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ from datetime import datetime, timezone
5
+ from matrice_inference.deploy.optimize.cache_manager import CacheManager
6
+ from matrice_inference.deploy.optimize.frame_comparators import SSIMComparator
7
+ from matrice_inference.deploy.optimize.transmission import ServerTransmissionHandler
8
+ from matrice_inference.deploy.server.inference.inference_interface import InferenceInterface
9
+ from matrice_inference.deploy.server.stream.video_buffer import VideoBufferManager
10
+ import asyncio
11
+ import base64
12
+ import cv2
13
+ import logging
14
+ import numpy as np
15
+
16
+ # Classes
17
+ class InferenceWorker:
18
+ """
19
+ Inference worker that processes messages from input queue and adds results to output queue.
20
+ """
21
+
22
+ def __init__(self: Any, worker_id: str, inference_interface: Any, input_queue: Any, output_queue: Any, process_timeout: float = 30.0, enable_video_buffering: bool = True, ssim_threshold: float = 0.95, cache_size: int = 100) -> None: ...
23
+ """
24
+ Initialize inference worker.
25
+
26
+ Args:
27
+ worker_id: Unique identifier for this worker
28
+ inference_interface: Inference interface to use for inference
29
+ input_queue: Queue to get messages from
30
+ output_queue: Queue to put results into
31
+ process_timeout: Timeout for inference processing
32
+ enable_video_buffering: Whether to enable video buffering
33
+ ssim_threshold: SSIM threshold for frame similarity (default: 0.95)
34
+ cache_size: Maximum number of cached results per stream
35
+ """
36
+
37
+ def get_metrics(self: Any) -> Dict[str, Any]: ...
38
+ """
39
+ Get worker metrics.
40
+ """
41
+
42
+ def reset_metrics(self: Any) -> None: ...
43
+ """
44
+ Reset worker metrics.
45
+ """
46
+
47
+ async def start(self: Any) -> None: ...
48
+ """
49
+ Start the inference worker.
50
+ """
51
+
52
+ async def stop(self: Any) -> None: ...
53
+ """
54
+ Stop the inference worker.
55
+ """
56
+
@@ -0,0 +1,51 @@
1
+ """Auto-generated stub for module: kafka_consumer_worker."""
2
+ from typing import Any, Dict, Optional
3
+
4
+ from datetime import datetime, timezone
5
+ from matrice_inference.deploy.optimize.transmission import ServerTransmissionHandler
6
+ from matrice_inference.deploy.stream.kafka_stream import MatriceKafkaDeployment
7
+ import asyncio
8
+ import base64
9
+ import logging
10
+
11
+ # Classes
12
+ class KafkaConsumerWorker:
13
+ """
14
+ Kafka consumer worker that polls from topics and adds to input queue.
15
+ """
16
+
17
+ def __init__(self: Any, worker_id: str, session: Any, deployment_id: str, deployment_instance_id: str, input_queue: Any, consumer_group_suffix: str = '', poll_timeout: float = 1.0, max_messages_per_poll: int = 1, inference_pipeline_id: str = '') -> None: ...
18
+ """
19
+ Initialize Kafka consumer worker.
20
+
21
+ Args:
22
+ worker_id: Unique identifier for this worker
23
+ session: Session object for authentication and RPC
24
+ deployment_id: ID of the deployment
25
+ deployment_instance_id: ID of the deployment instance
26
+ input_queue: Queue to put consumed messages into
27
+ consumer_group_suffix: Optional suffix for consumer group ID
28
+ poll_timeout: Timeout for Kafka polling
29
+ max_messages_per_poll: Maximum messages to consume in one poll
30
+ """
31
+
32
+ def get_metrics(self: Any) -> Dict[str, Any]: ...
33
+ """
34
+ Get worker metrics.
35
+ """
36
+
37
+ def reset_metrics(self: Any) -> None: ...
38
+ """
39
+ Reset worker metrics.
40
+ """
41
+
42
+ async def start(self: Any) -> None: ...
43
+ """
44
+ Start the consumer worker.
45
+ """
46
+
47
+ async def stop(self: Any) -> None: ...
48
+ """
49
+ Stop the consumer worker.
50
+ """
51
+