mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-11 16:40:30 +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:
@@ -78,16 +78,20 @@ void DataStreamer::RecordFirstIndex(uint64_t fnum, size_t firstImageIndex) {
|
||||
<< ", First Streamer Index:" << fnum;
|
||||
}
|
||||
|
||||
int DataStreamer::GetZmqHwm() const {
|
||||
if (zmqSocket) {
|
||||
return zmqSocket->GetSendHighWaterMark();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DataStreamer::CreateZmqSockets(uint16_t port, int hwm) {
|
||||
uint16_t portnum = port + index;
|
||||
try {
|
||||
zmqSocket = new ZmqSocket(portnum);
|
||||
|
||||
// set if custom
|
||||
if (hwm >= 0) {
|
||||
zmqSocket->SetSendHighWaterMark(hwm);
|
||||
// needed, or HWL is not taken
|
||||
zmqSocket->Rebind();
|
||||
zmqSocket = new ZmqSocket(portnum, hwm);
|
||||
} else {
|
||||
zmqSocket = new ZmqSocket(portnum);
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
std::ostringstream oss;
|
||||
|
||||
@@ -47,11 +47,13 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* Creates Zmq Sockets
|
||||
* (throws an exception if it couldnt create zmq sockets)
|
||||
* @param port streaming port start index
|
||||
* @param hwm streaming high water mark
|
||||
* @param hwm high water mark for zmq socket
|
||||
*/
|
||||
void CreateZmqSockets(uint16_t port, int hwm);
|
||||
void CloseZmqSocket();
|
||||
void StreamRxDummyHeader();
|
||||
void RestreamStop();
|
||||
int GetZmqHwm() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -1307,7 +1307,26 @@ void Implementation::setStreamingPort(const uint16_t i) {
|
||||
LOG(logINFO) << "Streaming Port: " << streamingPort;
|
||||
}
|
||||
|
||||
int Implementation::getStreamingHwm() const { return streamingHwm; }
|
||||
int Implementation::getStreamingHwm() const {
|
||||
switch (dataStreamer.size()) {
|
||||
case 0:
|
||||
return streamingHwm;
|
||||
case 2:
|
||||
if (dataStreamer[0]->GetZmqHwm() != dataStreamer[1]->GetZmqHwm()) {
|
||||
throw RuntimeError(
|
||||
"Streaming Hwm is not same for all data streamers: " +
|
||||
std::to_string(dataStreamer[0]->GetZmqHwm()) + ", " +
|
||||
std::to_string(dataStreamer[1]->GetZmqHwm()));
|
||||
}
|
||||
[[fallthrough]];
|
||||
case 1:
|
||||
return dataStreamer[0]->GetZmqHwm();
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Invalid number of data streamers: " +
|
||||
std::to_string(dataStreamer.size()));
|
||||
}
|
||||
}
|
||||
|
||||
void Implementation::setStreamingHwm(const int i) {
|
||||
streamingHwm = i;
|
||||
|
||||
Reference in New Issue
Block a user