diff options
author | Thomas White <taw@physics.org> | 2019-01-08 15:44:52 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2019-03-14 11:36:56 +0100 |
commit | 94ea1c4468fed5ee4be48e3334fe75541ecaba02 (patch) | |
tree | 37dcb31bb339e4f4b63780253740d10ab5ad4526 /src/indexamajig.c | |
parent | e9391fe842fee1966f195442ba9be7ada9199585 (diff) |
ZMQ connection and setup stuff
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r-- | src/indexamajig.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index 2d584726..356d0c94 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -86,6 +86,7 @@ static void show_help(const char *s) " --profile Show timing data for performance monitoring\n" " --temp-dir=<path> Put the temporary folder under <path>\n" " --wait-for-file=<n> Time to wait for each file before processing\n" +" --zmq-msgpack Receive data in MessagePack format over ZMQ\n" "\nPeak search options:\n\n" " --peaks=<method> Peak search method (zaef,peakfinder8,peakfinder9,hdf5,cxi)\n" " Default: zaef\n" @@ -340,6 +341,8 @@ int main(int argc, char *argv[]) int if_retry = 1; int serial_start = 1; char *spectrum_fn = NULL; + int zmq = 0; + char *zmq_address = NULL; /* Defaults */ iargs.cell = NULL; @@ -457,6 +460,7 @@ int main(int argc, char *argv[]) {"no-multi", 0, &if_multi, 0}, {"multi", 0, &if_multi, 1}, {"overpredict", 0, &iargs.overpredict, 1}, + {"zmq-msgpack", 0, &zmq, 1}, /* Long-only options which don't actually do anything */ {"no-sat-corr", 0, &iargs.satcorr, 0}, @@ -1297,8 +1301,22 @@ int main(int argc, char *argv[]) gsl_set_error_handler_off(); + if ( 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(&iargs, n_proc, prefix, config_basename, fh, - st, tmpdir, serial_start); + st, tmpdir, serial_start, zmq_address); free_imagefile_field_list(iargs.copyme); cell_free(iargs.cell); |