aboutsummaryrefslogtreecommitdiff
path: root/src/im-sandbox.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-01 15:50:31 +0200
committerThomas White <taw@physics.org>2022-06-02 12:15:38 +0200
commitb28228b5826235ca917d9f42af7d22f75b38bb13 (patch)
tree57738a8725df12bce74abd80777d8ff62fbb8029 /src/im-sandbox.c
parent095fb15a3136fc20642d3ff12bfe26a1aec1b797 (diff)
ASAP::O guts
Diffstat (limited to 'src/im-sandbox.c')
-rw-r--r--src/im-sandbox.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index bd3f47e7..ed58a3be 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -104,6 +104,13 @@ struct sandbox
int n_zmq_subscriptions;
const char *zmq_request;
+ /* ASAP::O mode */
+ int asapo;
+ const char *asapo_endpoint;
+ const char *asapo_token;
+ const char *asapo_beamtime;
+ const char *asapo_path;
+
/* Final output */
Stream *stream;
};
@@ -330,6 +337,7 @@ static int run_work(const struct index_args *iargs, Stream *st,
{
int allDone = 0;
struct im_zmq *zmqstuff = NULL;
+ struct im_asapo *asapostuff = NULL;
if ( sb->profile ) {
profile_init();
@@ -347,6 +355,17 @@ static int run_work(const struct index_args *iargs, Stream *st,
}
}
+ if ( sb->asapo ) {
+ zmqstuff = im_zmq_connect(sb->zmq_address,
+ sb->zmq_subscriptions,
+ sb->n_zmq_subscriptions,
+ sb->zmq_request);
+ if ( zmqstuff == NULL ) {
+ ERROR("ZMQ setup failed.\n");
+ return 1;
+ }
+ }
+
while ( !allDone ) {
struct pattern_args pargs;
@@ -1056,6 +1075,8 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
Stream *stream, const char *tmpdir, int serial_start,
const char *zmq_address, char **zmq_subscriptions,
int n_zmq_subscriptions, const char *zmq_request,
+ const char *asapo_endpoint, const char *asapo_token,
+ const char *asapo_beamtime, const char *asapo_path,
int timeout, int profile)
{
int i;
@@ -1096,6 +1117,21 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
sb->zmq = 0;
}
+ if ( asapo_endpoint != NULL ) {
+ sb->asapo = 1;
+ sb->asapo_endpoint = asapo_endpoint;
+ sb->asapo_token = asapo_token;
+ sb->asapo_beamtime = asapo_beamtime;
+ sb->asapo_path = asapo_path;
+ } else {
+ sb->asapo = 0;
+ }
+
+ if ( sb->zmq && sb->asapo ) {
+ ERROR("Cannot simultaneously use ZMQ and ASAP::O input.\n");
+ return 0;
+ }
+
sb->fds = NULL;
sb->fhs = NULL;
sb->stream = stream;