move zmq port to config file for C# and python

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-16 16:35:52 +02:00
parent 0d6ea4264f
commit 2ecbc9bfd4
17 changed files with 80 additions and 180 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
from user cimport User
from credentials cimport Credentials
from file_data cimport FileData
cdef class ApiClient:
cdef public Credentials credentials
+24
View File
@@ -0,0 +1,24 @@
pyinstaller --onefile ^
--collect-all pyyaml ^
--collect-all jwt ^
--collect-all requests ^
--collect-all psutil ^
--collect-all msgpack ^
--collect-all zmq ^
--collect-all cryptography ^
--collect-all cv2 ^
--collect-all onnxruntime ^
--hidden-import constants ^
--hidden-import annotation ^
--hidden-import credentials ^
--hidden-import file_data ^
--hidden-import user ^
--hidden-import security ^
--hidden-import secure_model ^
--hidden-import api_client ^
--hidden-import hardware_service ^
--hidden-import remote_command ^
--hidden-import ai_config ^
--hidden-import inference ^
--hidden-import remote_command_handler ^
start.py
+1
View File
@@ -0,0 +1 @@
zmq_port: 5128
+1 -1
View File
@@ -1,4 +1,4 @@
cdef int ZMQ_PORT = 5127 # Port for the zmq
cdef str CONFIG_FILE # Port for the zmq
cdef int QUEUE_MAXSIZE # Maximum size of the command queue
cdef str COMMANDS_QUEUE # Name of the commands queue in rabbit
+3 -3
View File
@@ -1,6 +1,6 @@
cdef int ZMQ_PORT = 5127 # Port for the zmq
cdef str CONFIG_FILE = "config.yaml" # Port for the zmq
cdef int QUEUE_MAXSIZE = 1000 # Maximum size of the command queue
cdef int QUEUE_MAXSIZE = 1000 # Maximum size of the command queue
cdef str COMMANDS_QUEUE = "azaion-commands"
cdef str ANNOTATIONS_QUEUE = "azaion-annotations"
@@ -9,4 +9,4 @@ cdef str QUEUE_CONFIG_FILENAME = "secured-config.json"
cdef str AI_MODEL_FILE = "azaion.onnx"
cdef bytes DONE_SIGNAL = b"DONE"
cdef int MODEL_BATCH_SIZE = 4
cdef int MODEL_BATCH_SIZE = 4
+4 -2
View File
@@ -3,7 +3,7 @@ import zmq
from threading import Thread, Event
from remote_command cimport RemoteCommand
cimport constants
import yaml
cdef class RemoteCommandHandler:
def __init__(self, object on_command):
@@ -12,7 +12,9 @@ cdef class RemoteCommandHandler:
self._router = self._context.socket(zmq.ROUTER)
self._router.setsockopt(zmq.LINGER, 0)
self._router.bind(f'tcp://*:{constants.ZMQ_PORT}')
with open(<str>constants.CONFIG_FILE, "r") as f:
config = yaml.safe_load(f)
self._router.bind(f'tcp://*:{config["zmq_port"]}')
self._dealer = self._context.socket(zmq.DEALER)
self._dealer.setsockopt(zmq.LINGER, 0)