aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-09-09 16:30:14 +0200
committerThomas White <taw@physics.org>2022-06-02 12:15:38 +0200
commit151924b7fccde4cb6bdb73128ba27c091037eb4b (patch)
treedfcaca887019e97be5272b02479ad3d9022aac97 /src
parent0c566e3bcc918f8f047fd3b2aad866f0e81e582f (diff)
ASAP::O: Expose data source
Diffstat (limited to 'src')
-rw-r--r--src/im-asapo.c16
-rw-r--r--src/im-asapo.h6
-rw-r--r--src/im-sandbox.c7
-rw-r--r--src/im-sandbox.h2
-rw-r--r--src/indexamajig.c9
5 files changed, 31 insertions, 9 deletions
diff --git a/src/im-asapo.c b/src/im-asapo.c
index 876de222..9d8fb171 100644
--- a/src/im-asapo.c
+++ b/src/im-asapo.c
@@ -92,17 +92,27 @@ struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- const char *group_id)
+ const char *group_id,
+ const char *data_source)
{
struct im_asapo *a;
+ int has_filesystem;
AsapoSourceCredentialsHandle cred;
AsapoErrorHandle err = asapo_new_handle();
a = malloc(sizeof(struct im_asapo));
if ( a == NULL ) return NULL;
- cred = asapo_create_source_credentials(kProcessed, beamtime, "", "", token);
- a->consumer = asapo_create_consumer(endpoint, path, 1, cred, &err);
+ cred = asapo_create_source_credentials(kProcessed, beamtime, "",
+ data_source, token);
+ if ( path == NULL ) {
+ path = "";
+ has_filesystem = 0;
+ } else {
+ has_filesystem = 1;
+ }
+ a->consumer = asapo_create_consumer(endpoint, path, has_filesystem,
+ cred, &err);
asapo_free_handle(&cred);
if ( asapo_is_error(err) ) {
show_asapo_error("Cannot create ASAP::O consumer", err);
diff --git a/src/im-asapo.h b/src/im-asapo.h
index 4f5c13f7..3160c69d 100644
--- a/src/im-asapo.h
+++ b/src/im-asapo.h
@@ -40,7 +40,8 @@ extern struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- const char *group_id);
+ const char *group_id,
+ const char *data_source);
extern void im_asapo_shutdown(struct im_asapo *a);
@@ -55,7 +56,8 @@ static UNUSED struct im_asapo *im_asapo_connect(const char *endpoint,
const char *token,
const char *beamtime,
const char *path,
- const char *group_id)
+ const char *group_id,
+ const char *data_source)
{
return NULL;
}
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index fed3873e..f1c0474f 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -112,6 +112,7 @@ struct sandbox
const char *asapo_beamtime;
const char *asapo_path;
const char *asapo_group_id;
+ const char *asapo_source;
/* Final output */
Stream *stream;
@@ -362,7 +363,8 @@ static int run_work(const struct index_args *iargs, Stream *st,
sb->asapo_token,
sb->asapo_beamtime,
sb->asapo_path,
- sb->asapo_group_id);
+ sb->asapo_group_id,
+ sb->asapo_source);
if ( asapostuff == NULL ) {
ERROR("ASAP::O setup failed.\n");
return 1;
@@ -1098,7 +1100,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
int n_zmq_subscriptions, const char *zmq_request,
const char *asapo_endpoint, const char *asapo_token,
const char *asapo_beamtime, const char *asapo_path,
- const char *asapo_group_id,
+ const char *asapo_group_id, const char *asapo_source,
int timeout, int profile)
{
int i;
@@ -1145,6 +1147,7 @@ int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
sb->asapo_token = asapo_token;
sb->asapo_beamtime = asapo_beamtime;
sb->asapo_path = asapo_path;
+ sb->asapo_source = asapo_source;
} else {
sb->asapo = 0;
}
diff --git a/src/im-sandbox.h b/src/im-sandbox.h
index 0415cb80..8d76b376 100644
--- a/src/im-sandbox.h
+++ b/src/im-sandbox.h
@@ -89,7 +89,7 @@ extern int create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
int n_zmq_subscriptions, const char *zmq_request,
const char *asapo_endpoint, const char *asapo_token,
const char *asapo_beamtime, const char *asapo_path,
- const char *asapo_group_id,
+ const char *asapo_group_id, const char *asapo_source,
int timeout, int profile);
#endif /* IM_SANDBOX_H */
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 52e83c57..7fbb3f8f 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -89,6 +89,7 @@ struct indexamajig_arguments
char *asapo_beamtime;
char *asapo_path;
char *asapo_group_id;
+ char *asapo_source;
int serial_start;
char *temp_location;
int if_refine;
@@ -427,6 +428,10 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
args->asapo_group_id = strdup(arg);
break;
+ case 218 :
+ args->asapo_source = strdup(arg);
+ break;
+
case 219 :
args->iargs.data_format = parse_data_format(arg);
if ( args->iargs.data_format == DATA_SOURCE_TYPE_UNKNOWN ) {
@@ -856,6 +861,7 @@ int main(int argc, char *argv[])
args.asapo_beamtime = NULL;
args.asapo_path = NULL;
args.asapo_group_id = NULL;
+ args.asapo_source = NULL;
args.n_zmq_subscriptions = 0;
args.serial_start = 1;
args.if_peaks = 1;
@@ -969,6 +975,7 @@ int main(int argc, char *argv[])
{"asapo-beamtime", 215, "str", OPTION_NO_USAGE, "ASAP::O beamtime ID"},
{"asapo-path", 216, "str", OPTION_NO_USAGE, "ASAP::O path to files"},
{"asapo-group", 217, "str", OPTION_NO_USAGE, "ASAP::O group ID"},
+ {"asapo-source", 218, "str", OPTION_NO_USAGE, "ASAP::O data source"},
{"data-format", 219, "str", OPTION_NO_USAGE, "Streamed data format"},
{NULL, 0, 0, OPTION_DOC, "Peak search options:", 3},
@@ -1332,7 +1339,7 @@ int main(int argc, char *argv[])
args.n_zmq_subscriptions, args.zmq_request,
args.asapo_endpoint, args.asapo_token,
args.asapo_beamtime, args.asapo_path,
- args.asapo_group_id,
+ args.asapo_group_id, args.asapo_source,
timeout, args.profile);
cell_free(args.iargs.cell);