mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-07 00:52:27 +02:00
dev: zmq hwm rebind (#1480)
Build on RHEL9 docker image / build (push) Successful in 5m3s
Build on RHEL8 docker image / build (push) Successful in 5m43s
Build and Deploy on local RHEL9 / build (push) Successful in 2m18s
Build and Deploy on local RHEL8 / build (push) Successful in 5m5s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m8s
Run Simulator Tests on local RHEL8 / build (push) Successful in 23m45s
Build on RHEL9 docker image / build (push) Successful in 5m3s
Build on RHEL8 docker image / build (push) Successful in 5m43s
Build and Deploy on local RHEL9 / build (push) Successful in 2m18s
Build and Deploy on local RHEL8 / build (push) Successful in 5m5s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m8s
Run Simulator Tests on local RHEL8 / build (push) Successful in 23m45s
* move hwm into the zmq constructor and reconstruct the socket instead of rebind. seems to work better than rebind (most connections cant bind so fast?) * fix after merge * added tests to reconnect zmq sockets when setting rx zmqport and rx zmqhwm, changed the tests scripts a bit to make the receiver starting tcp port configurable * tests: slsreceiver also starting up with 2000 as default tcp port, using latest cli args for receiver and multi receiver * releasr notes --------- Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
This commit is contained in:
@@ -21,7 +21,7 @@ from slsdet import Detector, Ctb, freeSharedMemory
|
||||
from utils_for_test import (
|
||||
Log,
|
||||
LogLevel,
|
||||
SERVER_START_PORTNO
|
||||
DET_START_TCP_PORTNO
|
||||
)
|
||||
|
||||
from conftest import session_simulator
|
||||
@@ -33,7 +33,7 @@ def test_exptime_after_free_should_raise(session_simulator):
|
||||
|
||||
|
||||
d = Ctb() # creates multi shm (assuming no shm exists)
|
||||
d.hostname = f"localhost:{SERVER_START_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
d.hostname = f"localhost:{DET_START_TCP_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
|
||||
d.free() # frees the shm, d should not map to it anymore
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_exptime_after_free_should_raise(session_simulator):
|
||||
|
||||
def free_and_create_shm():
|
||||
k = Ctb() # opens existing shm if it exists
|
||||
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
k.hostname = f"localhost:{DET_START_TCP_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
@pytest.mark.parametrize("session_simulator",[("ctb", 1, 1)],indirect=True)
|
||||
@@ -56,7 +56,7 @@ def test_exptime_after_not_passing_var_should_raise(session_simulator):
|
||||
|
||||
|
||||
d = Ctb() # creates multi shm (assuming no shm exists)
|
||||
d.hostname = f"localhost:{SERVER_START_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
d.hostname = f"localhost:{DET_START_TCP_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
|
||||
free_and_create_shm() # ctb() opens multi shm, hostname command frees and recreates mod shm but shm struct is local. d still maps to old shm struct
|
||||
|
||||
@@ -72,7 +72,7 @@ def test_exptime_after_not_passing_var_should_raise(session_simulator):
|
||||
|
||||
def free_and_create_shm_passing_ctb_var(k):
|
||||
k = Ctb() # opens existing shm if it exists (disregards k as its new Ctb only local to this function)
|
||||
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
k.hostname = f"localhost:{DET_START_TCP_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
@pytest.mark.parametrize("session_simulator",[("ctb", 1, 1)],indirect=True)
|
||||
@@ -80,7 +80,7 @@ def test_exptime_after_passing_ctb_var_should_raise(session_simulator):
|
||||
Log(LogLevel.INFOBLUE, f'\nRunning test_exptime_after_passing_ctb_var_should_raise')
|
||||
|
||||
d = Ctb() # creates multi shm (assuming no shm exists)
|
||||
d.hostname = f"localhost:{SERVER_START_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
d.hostname = f"localhost:{DET_START_TCP_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
|
||||
free_and_create_shm_passing_ctb_var(d) # ctb() opens multi shm, hostname command frees and recreates mod shm but shm struct is local. d still maps to old shm struct
|
||||
|
||||
@@ -95,7 +95,7 @@ def test_exptime_after_passing_ctb_var_should_raise(session_simulator):
|
||||
|
||||
def free_and_create_shm_returning_ctb():
|
||||
k = Ctb() # opens existing shm if it exists (disregards k as its new Ctb only local to this function)
|
||||
k.hostname = f"localhost:{SERVER_START_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
k.hostname = f"localhost:{DET_START_TCP_PORTNO}" # free and recreate shm, maps to local shm struct
|
||||
return k
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
@@ -128,8 +128,8 @@ def test_hostname_twice_acess_old_should_raise(session_simulator):
|
||||
Log(LogLevel.INFOBLUE, f'\nRunning test_hostname_twice_acess_old_should_raise')
|
||||
|
||||
d = Ctb() # creates multi shm (assuming no shm exists)
|
||||
d.hostname = f"localhost:{SERVER_START_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
d.hostname = f"localhost:{SERVER_START_PORTNO}" # Freeing and recreating shm while mapping d to it (old shm is out of scope)
|
||||
d.hostname = f"localhost:{DET_START_TCP_PORTNO}" # hostname command creates mod shm, d maps to it
|
||||
d.hostname = f"localhost:{DET_START_TCP_PORTNO}" # Freeing and recreating shm while mapping d to it (old shm is out of scope)
|
||||
|
||||
# this should not throw
|
||||
exptime_val = d.exptime
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import pytest
|
||||
import sys
|
||||
import time
|
||||
|
||||
from conftest import session_simulator
|
||||
|
||||
from slsdet import Detector
|
||||
from slsdet.utils import element_if_equal
|
||||
|
||||
from slsdet._slsdet import slsDetectorDefs
|
||||
from utils_for_test import (
|
||||
Log,
|
||||
LogLevel,
|
||||
)
|
||||
|
||||
detectorType = slsDetectorDefs.detectorType
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
@pytest.mark.parametrize(
|
||||
"session_simulator",
|
||||
[
|
||||
("eiger", 1, 20)
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
def test_zmq_reconnect(session_simulator, request):
|
||||
""" Test changing zmq ports and zmq hwm with zmq sockets connected (reconnect). """
|
||||
det_type, num_interfaces, num_mods, d = session_simulator
|
||||
assert d is not None
|
||||
assert d.type == detectorType.EIGER
|
||||
|
||||
|
||||
d.rx_zmqstream = True
|
||||
assert d.rx_zmqstream == True
|
||||
|
||||
port = 14000
|
||||
hwm = 2
|
||||
|
||||
for _ in range(10):
|
||||
d.rx_zmqport = port
|
||||
d.rx_zmqhwm = hwm
|
||||
Log(LogLevel.INFOGREEN, f"Set zmqport={port}, zmqhwm={hwm}")
|
||||
|
||||
port += 1000
|
||||
hwm += 5
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user