aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/indexamajig.110
-rw-r--r--src/indexamajig.c54
2 files changed, 28 insertions, 36 deletions
diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1
index 44f46c18..d3077516 100644
--- a/doc/man/indexamajig.1
+++ b/doc/man/indexamajig.1
@@ -177,6 +177,11 @@ Write the output data stream to \fIfilename\fR.
Read the detector geometry description from \fIfilename\fR. See \fBman crystfel_geometry\fR for more information.
.PD 0
+.IP \fB--zmq-input=\fIaddress\fR
+.PD
+Receive data over ZeroMQ from \fIaddress\fR. In this version, the ZeroMQ data will be assumed to be serialised with MsgPack, but other formats might be added in future. The options \fB--input\fR and \fB--zmq-input\fR are mutually exclusive - you must specify exactly one of them. Example: \fB--zmq-input=tcp://127.0.0.1:5002\fR.
+
+.PD 0
.IP \fB--basename\fR
.PD
Remove the directory parts of the filenames taken from the input file. If \fB--prefix\fR or \fB-x\fR is also given, the directory parts of the filename will be removed \fIbefore\fR adding the prefix.
@@ -217,11 +222,6 @@ Put the temporary folder under \fIpath\fR.
.PD
Wait at most \fIn\fR seconds for each image file in the input list to be created before trying to process it. This is useful for some automated processing pipelines. It obviously only really works for single-frame files. If a file exists but is not readable when this option is set non-zero, a second attempt will be made after ten seconds. This is to allow for incompletely written files. A value of -1 means to wait forever. The default value is \fB--wait-for-file=0\fR.
-.PD 0
-.IP \fB--zmq-msgpack\fR
-.PD
-Receive data as MessagePack objects over ZeroMQ. The input "file list", given with \fB--input\fR or \fB-i\fR, should contain a socket URL suitable for passing to zmq_connect(), such as "tcp://127.0.0.1:12322". At the moment, only one URL can be given, but this may change in future.
-
.IP \fB--no-image-data\fR
.PD
Do not load the actual image data (or bad pixel masks), only the metadata. This allows you to check if patterns can be indexed, without high data bandwidth requirements. Obviously, any feature requiring the image data, especially peak search procedures and integration, cannot be used in this case. At the moment, this option only works when \fB--zmq-msgpack\fR is also used. You will probably want to use \fB--peaks=msgpack\fR.
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ea9c4519..27071256 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -80,7 +80,7 @@ struct indexamajig_arguments
char *cellfile;
char *indm_str;
int basename;
- int zmq;
+ char *zmq_addr;
int serial_start;
char *temp_location;
int if_refine;
@@ -346,7 +346,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
break;
case 207 :
- args->zmq = 1;
+ args->zmq_addr = strdup(arg);
break;
case 208 :
@@ -750,13 +750,12 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
int main(int argc, char *argv[])
{
- FILE *fh;
+ FILE *fh = NULL;
Stream *st;
struct indexamajig_arguments args;
char *tmpdir; /* e.g. /tmp/indexamajig.12345 */
char *rn; /* e.g. /home/taw/indexing */
int r;
- char *zmq_address = NULL;
int timeout = 240;
TakeTwoOptions *taketwo_opts = NULL;
FelixOptions *felix_opts = NULL;
@@ -776,7 +775,7 @@ int main(int argc, char *argv[])
args.cellfile = NULL;
args.indm_str = NULL;
args.basename = 0;
- args.zmq = 0;
+ args.zmq_addr = NULL;
args.serial_start = 1;
args.if_peaks = 1;
args.if_multi = 0;
@@ -874,8 +873,8 @@ int main(int argc, char *argv[])
{"temp-dir", 205, "path", OPTION_NO_USAGE, "Location for temporary folder"},
{"wait-for-file", 206, "seconds", OPTION_NO_USAGE, "Wait for each file before "
"processing"},
- {"zmq-msgpack", 207, NULL, OPTION_NO_USAGE, "Receive data in MessagePack format "
- "over ZMQ"},
+ {"zmq-input", 207, "addr", OPTION_NO_USAGE, "Receive data over ZeroMQ from "
+ "this location"},
{"no-image-data", 208, NULL, OPTION_NO_USAGE, "Do not load image data"},
{"spectrum-file", 209, "fn", OPTION_NO_USAGE | OPTION_HIDDEN,
"File containing radiation spectrum"},
@@ -996,7 +995,7 @@ int main(int argc, char *argv[])
if ( argp_parse(&argp, argc, argv, 0, NULL, &args) ) return 1;
/* Check for minimal information */
- if ( args.filename == NULL ) {
+ if ( (args.filename == NULL) && (args.zmq_addr == NULL) ) {
ERROR("You need to provide the input filename (use -i)\n");
return 1;
}
@@ -1009,17 +1008,24 @@ int main(int argc, char *argv[])
return 1;
}
- /* Open input */
- if ( strcmp(args.filename, "-") == 0 ) {
- fh = stdin;
- } else {
- fh = fopen(args.filename, "r");
- }
- if ( fh == NULL ) {
- ERROR("Failed to open input file '%s'\n", args.filename);
+ if ( (args.filename != NULL) && (args.zmq_addr != NULL) ) {
+ ERROR("You must only specify one of --input and --zmq-input.\n");
return 1;
}
+ /* Open input */
+ if ( args.filename != NULL ) {
+ if ( strcmp(args.filename, "-") == 0 ) {
+ fh = stdin;
+ } else {
+ fh = fopen(args.filename, "r");
+ }
+ if ( fh == NULL ) {
+ ERROR("Failed to open input file '%s'\n", args.filename);
+ return 1;
+ }
+ }
+
/* Check prefix (if given) */
if ( args.check_prefix ) {
args.prefix = check_prefix(args.prefix);
@@ -1221,22 +1227,8 @@ int main(int argc, char *argv[])
gsl_set_error_handler_off();
- if ( args.zmq ) {
- char line[1024];
- char *rval;
- rval = fgets(line, 1024, fh);
- if ( rval == NULL ) {
- ERROR("Failed to read ZMQ server/port from input.\n");
- return 1;
- }
- chomp(line);
- zmq_address = strdup(line);
- /* In future, read multiple addresses and hand them out
- * evenly to workers */
- }
-
r = create_sandbox(&args.iargs, args.n_proc, args.prefix, args.basename,
- fh, st, tmpdir, args.serial_start, zmq_address,
+ fh, st, tmpdir, args.serial_start, args.zmq_addr,
timeout, args.profile);
cell_free(args.iargs.cell);