last image recv also closes the file

This commit is contained in:
lhdamiani
2021-07-13 16:44:05 +02:00
parent bfce762ff3
commit 66f63c1c08
+9 -10
View File
@@ -52,7 +52,7 @@ int main (int argc, char *argv[])
JFH5Writer writer(config.detector_name);
WriterStats stats(config.detector_name, IMAGE_N_BYTES);
char recv_buffer[8192];
char recv_buffer[12288];
while (true) {
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 i_image = document["i_image"].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.
if (i_image == 0) {
@@ -88,7 +80,7 @@ int main (int argc, char *argv[])
image_meta->dtype);
}
// Fair distribution of images among writers.
if (i_image % n_writers == i_writer) {
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);
}
// i_image == n_images -> end of run.
if (i_image == n_images - 1) {
writer.close_run();
stats.end_run();
continue;
}
}
}