v1.0.0_rc.11

This commit is contained in:
2024-06-30 17:48:35 +02:00
parent 53b5a304d3
commit 3035d9e144
93 changed files with 586 additions and 213 deletions
+42 -9
View File
@@ -55,17 +55,17 @@ void ZMQStream2Pusher::StartDataCollection(StartMessage& message) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Images per file cannot be zero or negative");
images_per_file = message.images_per_file;
run_number = message.run_number;
run_name = message.run_name;
serializer.SerializeSequenceStart(message);
for (auto &s: socket) {
if (!s->Send(serialization_buffer.data(), serializer.GetBufferSize(), true))
throw JFJochException(JFJochExceptionCategory::ZeroMQ, "Timeout on pushing start message on addr "
+ s->GetEndpointName());
if (message.write_master_file) {
for (int i = 0; i < socket.size(); i++) {
message.socket_number = i;
if (i > 0)
message.write_master_file = false;
serializer.SerializeSequenceStart(message);
}
serializer.SerializeSequenceStart(message);
if (!socket[i]->Send(serialization_buffer.data(), serializer.GetBufferSize(), true))
throw JFJochException(JFJochExceptionCategory::ZeroMQ, "Timeout on pushing start message on addr "
+ socket[i]->GetEndpointName());
}
if (preview_socket)
@@ -115,3 +115,36 @@ std::string ZMQStream2Pusher::GetPreviewAddress() {
else
return "";
}
void ZMQStream2Pusher::Finalize() {
if (writer_notification_socket) {
for (int i = 0; i < socket.size(); i++) {
auto n = writer_notification_socket->Receive(run_number, run_name);
if (!n)
throw JFJochException(JFJochExceptionCategory::FileWriteError, "No notification received from writer");
else if (n->socket_number >= socket.size())
throw JFJochException(JFJochExceptionCategory::FileWriteError, "Wrong socket number provided in the message");
else if (!n->ok)
throw JFJochException(JFJochExceptionCategory::FileWriteError, "Writer (socket "
+ socket[n->socket_number]->GetEndpointName()
+ ") finished with error");
}
}
}
std::string ZMQStream2Pusher::GetWriterNotificationSocketAddress() const {
if (writer_notification_socket)
return writer_notification_socket->GetEndpointName();
else
return "";
}
ZMQStream2Pusher &ZMQStream2Pusher::WriterNotificationSocket(const std::string &addr) {
writer_notification_socket = std::make_unique<ZMQWriterNotificationPuller>(addr);
return *this;
}
ZMQStream2Pusher &ZMQStream2Pusher::PreviewCounterPeriod(std::chrono::microseconds input) {
preview_counter.Period(input);
return *this;
}