mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-06 05:24:14 +02:00
last image recv also closes the file
This commit is contained in:
@@ -52,7 +52,7 @@ int main (int argc, char *argv[])
|
|||||||
JFH5Writer writer(config.detector_name);
|
JFH5Writer writer(config.detector_name);
|
||||||
WriterStats stats(config.detector_name, IMAGE_N_BYTES);
|
WriterStats stats(config.detector_name, IMAGE_N_BYTES);
|
||||||
|
|
||||||
char recv_buffer[8192];
|
char recv_buffer[12288];
|
||||||
while (true) {
|
while (true) {
|
||||||
zmq_recv(receiver, &recv_buffer, sizeof(recv_buffer), 0);
|
zmq_recv(receiver, &recv_buffer, sizeof(recv_buffer), 0);
|
||||||
|
|
||||||
@@ -66,14 +66,6 @@ int main (int argc, char *argv[])
|
|||||||
const int run_id = document["run_id"].GetInt();
|
const int run_id = document["run_id"].GetInt();
|
||||||
const int i_image = document["i_image"].GetInt();
|
const int i_image = document["i_image"].GetInt();
|
||||||
const int n_images = document["n_images"].GetInt();
|
const int n_images = document["n_images"].GetInt();
|
||||||
|
|
||||||
// i_image == n_images -> end of run.
|
|
||||||
if (i_image == n_images) {
|
|
||||||
writer.close_run();
|
|
||||||
|
|
||||||
stats.end_run();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// i_image == 0 -> we have a new run.
|
// i_image == 0 -> we have a new run.
|
||||||
if (i_image == 0) {
|
if (i_image == 0) {
|
||||||
@@ -88,7 +80,7 @@ int main (int argc, char *argv[])
|
|||||||
image_meta->dtype);
|
image_meta->dtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fair distribution of images among writers.
|
// Fair distribution of images among writers.
|
||||||
if (i_image % n_writers == i_writer) {
|
if (i_image % n_writers == i_writer) {
|
||||||
char* data = image_buffer.get_slot_data(image_id);
|
char* data = image_buffer.get_slot_data(image_id);
|
||||||
@@ -105,5 +97,12 @@ int main (int argc, char *argv[])
|
|||||||
writer.write_meta(run_id, i_image, image_meta);
|
writer.write_meta(run_id, i_image, image_meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// i_image == n_images -> end of run.
|
||||||
|
if (i_image == n_images - 1) {
|
||||||
|
writer.close_run();
|
||||||
|
stats.end_run();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user