From a378be62b61d4c8a67c5523955babbd3f9d17b5c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 23 Apr 2021 16:26:24 +0200 Subject: indexamajig: Generate a unique filename for ZMQ data The unique filename is needed by the GUI for looking up results in a stream. Otherwise, the filename is "(null)" for everything and the lookup just returns the first chunk in the stream. The filename is generated based on the unique serial number for each chunk, and is therefore unique across one run of indexamajig regardless of the number of worker processes (-j). This might have to change in future to accommodate jobs run across multiple nodes, if there is any demand for looking at results in one big concatenated stream. This also changes the condition for deciding when to look for a 'real' file, to take into account that there is always a non-NULL filename. --- libcrystfel/src/image.c | 9 ++++++--- libcrystfel/src/image.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index ad651cae..b40819ef 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -669,7 +669,7 @@ int image_set_zero_mask(struct image *image, static int image_read_image_data(struct image *image, const DataTemplate *dtempl) { - if ( (image->filename != NULL) + if ( (image->data_block == NULL) && (!file_exists(image->filename)) ) { ERROR("File not found: %s (read data)\n", image->filename); @@ -1201,10 +1201,12 @@ struct image *image_read_data_block(const DataTemplate *dtempl, void *data_block, size_t data_block_size, DataSourceType type, + int serial, int no_image_data, int no_mask_data) { struct image *image; + char tmp[64]; if ( dtempl == NULL ) { ERROR("NULL data template!\n"); @@ -1217,8 +1219,9 @@ struct image *image_read_data_block(const DataTemplate *dtempl, return NULL; } - image->filename = NULL; - image->ev = NULL; + snprintf(tmp, 63, "datablock-%i", serial); + image->filename = strdup(tmp); + image->ev = strdup("//"); image->data_block = data_block; image->data_block_size = data_block_size; diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 58228e35..045f3e77 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -216,6 +216,7 @@ extern struct image *image_read_data_block(const DataTemplate *dtempl, void *data_block, size_t data_block_size, DataSourceType type, + int serial, int no_image_data, int no_mask_data); extern void image_free(struct image *image); -- cgit v1.2.3