diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0bb8359b49337832d0af66fee79e736f9eb23f7d..d0424c79910356e0b6dc563c5f43f037bb12a7cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,10 +46,12 @@ rpc: needs: [build] script: - export ASAN_OPTIONS=detect_odr_violation=0 - - export LSAN_OPTIONS=verbosity=1:log_threads=1:suppressions=tests/LSanSuppress.supp + - export LSAN_OPTIONS=verbosity=1:log_threads=1:suppressions=${CI_PROJECT_DIR}/tests/LSanSuppress.supp - export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:${CI_PROJECT_DIR}/compiled/lib - compiled/bin/scord -f --force-console & - build/examples/cxx/ADM_ping ofi+tcp://127.0.0.1:52000 + - cd build/examples/ + - ctest -j$(nproc) --output-on-failure --output-junit report.xml - pkill -TERM scord # run unit tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 78e2d3e8472d14388f33688d8f855e168b6b8efb..27f606aa311c8e83ad9035e6f6ae720e12c7fd35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_ASAN # make sure that debug versions for targets are used (if provided) in Debug mode set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS Debug) +set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS ASan) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/examples/c/ADM_cancel_transfer.c b/examples/c/ADM_cancel_transfer.c new file mode 100644 index 0000000000000000000000000000000000000000..5b2d79dadc94aecc4e71f92d4e9a824aa232931c --- /dev/null +++ b/examples/c/ADM_cancel_transfer.c @@ -0,0 +1,115 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_cancel_transfer \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t** sources = NULL; + ADM_dataset_t** targets = NULL; + ADM_qos_limit_t** limits = NULL; + ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; + ADM_transfer_t tx; + ret = ADM_transfer_dataset(server, job, sources, targets, limits, mapping, + &tx); + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_transfer_dataset() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + ret = ADM_cancel_transfer(server, job, tx); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_cancel_transfer() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_cancel_transfer() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_connect_data_operation.c b/examples/c/ADM_connect_data_operation.c new file mode 100644 index 0000000000000000000000000000000000000000..35ad5bdcaa202e26ef01a0ed368c042bc57c017e --- /dev/null +++ b/examples/c/ADM_connect_data_operation.c @@ -0,0 +1,115 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no server address provided\n"); + fprintf(stderr, "Usage: ADM_connect_data_operation \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + exit_status = EXIT_SUCCESS; + + bool should_stream = false; + ret = ADM_connect_data_operation(server, job, inputs[0], outputs[0], + should_stream); + + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_connect_data_operation() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_connect_data_operation() remote procedure completed " + "successfully\n"); + +cleanup: + for(int i = 0; i < NINPUTS; ++i) { + ADM_dataset_destroy(inputs[i]); + } + + for(int i = 0; i < NOUTPUTS; ++i) { + ADM_dataset_destroy(outputs[i]); + } + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_define_data_operation.c b/examples/c/ADM_define_data_operation.c new file mode 100644 index 0000000000000000000000000000000000000000..5d8a5754e1e261933b51cc7ea664e5cf0c4d6f6b --- /dev/null +++ b/examples/c/ADM_define_data_operation.c @@ -0,0 +1,107 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_define_data_operation \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_data_operation_t op; + const char* path = "/tmpxxxxx"; + // va_list args; // FIXME placeholder + + ret = ADM_define_data_operation(server, job, path, &op); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_define_data_operation() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_define_data_operation() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_deploy_adhoc_storage.c b/examples/c/ADM_deploy_adhoc_storage.c new file mode 100644 index 0000000000000000000000000000000000000000..7985be8734acd0ddbaf64a6dabecfc2570f193ba --- /dev/null +++ b/examples/c/ADM_deploy_adhoc_storage.c @@ -0,0 +1,118 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_deploy_adhoc_storage \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_storage_t adhoc_storage; + + ret = ADM_register_adhoc_storage(server, job, ctx, &adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_register_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_register_adhoc_storage() remote procedure completed " + "successfully\n"); + + ret = ADM_deploy_adhoc_storage(server, job, adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_deploy_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_deploy_adhoc_storage() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_finalize_data_operation.c b/examples/c/ADM_finalize_data_operation.c new file mode 100644 index 0000000000000000000000000000000000000000..4c4231f62efa701e53e0113e19bfb46347897442 --- /dev/null +++ b/examples/c/ADM_finalize_data_operation.c @@ -0,0 +1,108 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, + "Usage: ADM_finalize_data_operation \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + ADM_data_operation_t op; + const char* path = "/tmpxxxxx"; + + ADM_define_data_operation(server, job, path, &op); + ADM_data_operation_status_t status; + + ret = ADM_finalize_data_operation(server, job, op, &status); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_finalize_data_operation() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_finalize_data_operation() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_get_pending_transfers.c b/examples/c/ADM_get_pending_transfers.c new file mode 100644 index 0000000000000000000000000000000000000000..55f4b15cd4efaa2975d5ffbe4793b12a1fefce53 --- /dev/null +++ b/examples/c/ADM_get_pending_transfers.c @@ -0,0 +1,103 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_get_pending_transfers \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + ADM_transfer_t** tx = NULL; + + ret = ADM_get_pending_transfers(server, job, tx); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_get_pending_transfers() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_get_pending_transfers() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_get_qos_constraints.c b/examples/c/ADM_get_qos_constraints.c new file mode 100644 index 0000000000000000000000000000000000000000..03265442ed4145a903138a2d1e42f70b697c7874 --- /dev/null +++ b/examples/c/ADM_get_qos_constraints.c @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_get_qos_constraints \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_qos_entity_t entity = NULL; + ADM_qos_limit_t* limits; + + ret = ADM_get_qos_constraints(server, job, entity, &limits); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_get_qos_constraints() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_get_qos_constraints() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_get_statistics.c b/examples/c/ADM_get_statistics.c new file mode 100644 index 0000000000000000000000000000000000000000..af8a3f19cc7efe14fe25abb083c885ae7076648f --- /dev/null +++ b/examples/c/ADM_get_statistics.c @@ -0,0 +1,102 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_get_statistics \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + ADM_job_stats_t* stats = NULL; + + ret = ADM_get_statistics(server, job, &stats); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_get_statistics() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_get_statistics() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_get_transfer_priority.c b/examples/c/ADM_get_transfer_priority.c new file mode 100644 index 0000000000000000000000000000000000000000..e07fb07363356419c8399b1558619fccf489b746 --- /dev/null +++ b/examples/c/ADM_get_transfer_priority.c @@ -0,0 +1,118 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_get_transfer_priority \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t** sources = NULL; + ADM_dataset_t** targets = NULL; + ADM_qos_limit_t** limits = NULL; + ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; + ADM_transfer_t tx; + ret = ADM_transfer_dataset(server, job, sources, targets, limits, mapping, + &tx); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_transfer_dataset() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + ADM_transfer_priority_t priority; + + ret = ADM_get_transfer_priority(server, job, tx, &priority); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_get_transfer_priority() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_get_transfer_priority() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_link_transfer_to_data_operation.c b/examples/c/ADM_link_transfer_to_data_operation.c new file mode 100644 index 0000000000000000000000000000000000000000..ba03648207ead7cbf23b5df3f8f99762199c1b69 --- /dev/null +++ b/examples/c/ADM_link_transfer_to_data_operation.c @@ -0,0 +1,124 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, + "Usage: ADM_link_transfer_to_data_operation \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_data_operation_t op; + const char* path = "/tmpxxxxx"; + ADM_define_data_operation(server, job, path, &op); + ADM_dataset_t** sources = NULL; + ADM_dataset_t** targets = NULL; + ADM_qos_limit_t** limits = NULL; + ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; + ADM_transfer_t tx; + ret = ADM_transfer_dataset(server, job, sources, targets, limits, mapping, + &tx); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_transfer_dataset() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + bool should_stream = false; + va_list args; + + ret = ADM_link_transfer_to_data_operation(server, job, op, tx, + should_stream, args); + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_link_transfer_to_data_operation() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, + "ADM_link_transfer_to_data_operation() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_register_adhoc_storage.c b/examples/c/ADM_register_adhoc_storage.c new file mode 100644 index 0000000000000000000000000000000000000000..2964ae5147ed9915add3d15a0c8ae1a489e144dc --- /dev/null +++ b/examples/c/ADM_register_adhoc_storage.c @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_register_adhoc_storage \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_storage_t adhoc_storage; + + ret = ADM_register_adhoc_storage(server, job, ctx, &adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_register_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_register_adhoc_storage() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_register_job.c b/examples/c/ADM_register_job.c index 7c53dceb0b9eebc065d054427f22fdd9d70d3259..6d59e74cffab3373fbc50c35ecc003de15ba2080 100644 --- a/examples/c/ADM_register_job.c +++ b/examples/c/ADM_register_job.c @@ -1,7 +1,31 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include -#include #include +#include #define NINPUTS 10 #define NOUTPUTS 5 @@ -11,7 +35,7 @@ main(int argc, char* argv[]) { if(argc != 2) { fprintf(stderr, "ERROR: no location provided\n"); - fprintf(stderr, "Usage: ADM_register_job \n"); + fprintf(stderr, "Usage: ADM_register_job \n"); exit(EXIT_FAILURE); } diff --git a/examples/c/ADM_remove_adhoc_storage.c b/examples/c/ADM_remove_adhoc_storage.c new file mode 100644 index 0000000000000000000000000000000000000000..b84208d723776eb4d0271bb183a418deea496995 --- /dev/null +++ b/examples/c/ADM_remove_adhoc_storage.c @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_remove_adhoc_storage \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_storage_t adhoc_storage; + ret = ADM_register_adhoc_storage(server, job, ctx, &adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_register_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_register_adhoc_storage() remote procedure completed " + "successfully\n"); + + ret = ADM_remove_adhoc_storage(server, job, adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_remove_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_remove_adhoc_storage() remote procedure completed " + "successfully\n"); + +cleanup: + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_remove_job.c b/examples/c/ADM_remove_job.c new file mode 100644 index 0000000000000000000000000000000000000000..6172c890ee3876faa0b813ded94b4446214650c7 --- /dev/null +++ b/examples/c/ADM_remove_job.c @@ -0,0 +1,101 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_remove_job \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ret = ADM_remove_job(server, job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_remove_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_remove_job() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_set_dataset_information.c b/examples/c/ADM_set_dataset_information.c new file mode 100644 index 0000000000000000000000000000000000000000..7e3e3d410226a39127e899890e114102dde1ae2c --- /dev/null +++ b/examples/c/ADM_set_dataset_information.c @@ -0,0 +1,105 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, + "Usage: ADM_set_dataset_information \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t target = NULL; + ADM_dataset_info_t info = NULL; + ret = ADM_set_dataset_information(server, job, target, info); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_set_dataset_information() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_set_dataset_information() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_set_io_resources.c b/examples/c/ADM_set_io_resources.c new file mode 100644 index 0000000000000000000000000000000000000000..307c3294309f7e273b28dd2ba6fab51d4feb5a68 --- /dev/null +++ b/examples/c/ADM_set_io_resources.c @@ -0,0 +1,105 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_set_io_resources \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_storage_t tier = NULL; + ADM_storage_resources_t resources = NULL; + ret = ADM_set_io_resources(server, job, tier, resources); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_set_io_resources() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_set_io_resources() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_set_qos_constraints.c b/examples/c/ADM_set_qos_constraints.c new file mode 100644 index 0000000000000000000000000000000000000000..03e0423c7ac1fbfbdeae3c1b3a1227fc145f458d --- /dev/null +++ b/examples/c/ADM_set_qos_constraints.c @@ -0,0 +1,106 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_set_qos_constraints \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_qos_entity_t entity = NULL; + ADM_qos_limit_t limit = NULL; + + ret = ADM_set_qos_constraints(server, job, entity, limit); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_set_qos_constraints() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_set_qos_constraints() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_set_transfer_priority.c b/examples/c/ADM_set_transfer_priority.c new file mode 100644 index 0000000000000000000000000000000000000000..4993e9e7dacb9741eab11430685d43aa1bfd7643 --- /dev/null +++ b/examples/c/ADM_set_transfer_priority.c @@ -0,0 +1,112 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_set_transfer_priority \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t** sources = NULL; + ADM_dataset_t** targets = NULL; + ADM_qos_limit_t** limits = NULL; + ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; + ADM_transfer_t tx; + ret = ADM_transfer_dataset(server, job, sources, targets, limits, mapping, + &tx); + + int incr = 42; + ret = ADM_set_transfer_priority(server, job, tx, incr); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_set_transfer_priority() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_set_transfer_priority() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_transfer_dataset.c b/examples/c/ADM_transfer_dataset.c new file mode 100644 index 0000000000000000000000000000000000000000..6f540511a117d18583654f48678bd32f5d114e06 --- /dev/null +++ b/examples/c/ADM_transfer_dataset.c @@ -0,0 +1,108 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_transfer_dataset \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t** sources = NULL; + ADM_dataset_t** targets = NULL; + ADM_qos_limit_t** limits = NULL; + ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; + ADM_transfer_t tx; + ret = ADM_transfer_dataset(server, job, sources, targets, limits, mapping, + &tx); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_transfer_dataset() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_transfer_dataset() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_update_adhoc_storage.c b/examples/c/ADM_update_adhoc_storage.c new file mode 100644 index 0000000000000000000000000000000000000000..c8dbaf74bd35fe7f7856db531a25a67d96068693 --- /dev/null +++ b/examples/c/ADM_update_adhoc_storage.c @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_update_adhoc_storage \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_storage_t adhoc_storage; + ret = ADM_register_adhoc_storage(server, job, ctx, &adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_register_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_register_adhoc_storage() remote procedure completed " + "successfully\n"); + + ret = ADM_update_adhoc_storage(server, job, ctx, adhoc_storage); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, + "ADM_update_adhoc_storage() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_update_adhoc_storage() remote procedure completed " + "successfully\n"); + +cleanup: + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/ADM_update_job.c b/examples/c/ADM_update_job.c new file mode 100644 index 0000000000000000000000000000000000000000..62fbbd39be01ebdbef901866bea50b27d96ce6c1 --- /dev/null +++ b/examples/c/ADM_update_job.c @@ -0,0 +1,133 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + +#include +#include +#include +#include + +#define NINPUTS 10 +#define NOUTPUTS 5 + +int +main(int argc, char* argv[]) { + + if(argc != 2) { + fprintf(stderr, "ERROR: no location provided\n"); + fprintf(stderr, "Usage: ADM_update_job \n"); + exit(EXIT_FAILURE); + } + + int exit_status = EXIT_SUCCESS; + ADM_server_t server = ADM_server_create("tcp", argv[1]); + + ADM_job_t job; + + ADM_dataset_t inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + outputs[i] = ADM_dataset_create(id); + } + + ADM_adhoc_context_t ctx = ADM_adhoc_context_create( + ADM_ADHOC_MODE_SEPARATE_NEW, ADM_ADHOC_ACCESS_RDWR, 42, 100, false); + assert(ctx); + + ADM_storage_t st = ADM_storage_create("foobar", ADM_STORAGE_GEKKOFS, ctx); + assert(st); + + ADM_job_requirements_t reqs = + ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); + assert(reqs); + + ADM_return_t ret = ADM_register_job(server, reqs, &job); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_register_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + } + + ADM_dataset_t new_inputs[NINPUTS]; + + for(int i = 0; i < NINPUTS; ++i) { + const char* pattern = "input-new-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + new_inputs[i] = ADM_dataset_create(id); + } + + ADM_dataset_t new_outputs[NOUTPUTS]; + + for(int i = 0; i < NOUTPUTS; ++i) { + const char* pattern = "output-new-dataset-%d"; + size_t n = snprintf(NULL, 0, pattern, i); + char* id = (char*) alloca(n + 1); + snprintf(id, n + 1, pattern, i); + new_outputs[i] = ADM_dataset_create(id); + } + + ADM_job_requirements_t new_reqs = ADM_job_requirements_create( + new_inputs, NINPUTS, new_outputs, NOUTPUTS, st); + + ret = ADM_update_job(server, job, new_reqs); + + if(ret != ADM_SUCCESS) { + fprintf(stdout, "ADM_update_job() remote procedure not completed " + "successfully\n"); + exit_status = EXIT_FAILURE; + goto cleanup; + } + + fprintf(stdout, "ADM_update_job() remote procedure completed " + "successfully\n"); + +cleanup: + + for(int i = 0; i < NINPUTS; ++i) { + ADM_dataset_destroy(inputs[i]); + } + + for(int i = 0; i < NOUTPUTS; ++i) { + ADM_dataset_destroy(outputs[i]); + } + + ADM_server_destroy(server); + exit(exit_status); +} diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index ff36f94ac65f6402b2f6ffec6b5d6cedc23c889d..3f683cc04b26cd6000b522bc74253a87ec9c81d3 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain # +# Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # @@ -22,11 +22,68 @@ # SPDX-License-Identifier: GPL-3.0-or-later # ################################################################################ -list(APPEND examples_c ADM_register_job) +list(APPEND examples_c ADM_register_job ADM_cancel_transfer ADM_connect_data_operation ADM_define_data_operation + ADM_deploy_adhoc_storage ADM_finalize_data_operation ADM_get_pending_transfers ADM_get_qos_constraints + ADM_get_statistics ADM_get_transfer_priority ADM_link_transfer_to_data_operation + ADM_register_adhoc_storage ADM_remove_adhoc_storage ADM_remove_job ADM_set_dataset_information + ADM_set_io_resources ADM_set_qos_constraints ADM_set_transfer_priority ADM_transfer_dataset + ADM_update_adhoc_storage ADM_update_job) +# ADM_in_situ_ops ADM_in_transit_ops not implemented foreach(example IN LISTS examples_c) add_executable(${example}_c) target_sources(${example}_c PRIVATE ${example}.c) target_link_libraries(${example}_c PUBLIC adm_iosched) set_target_properties(${example}_c PROPERTIES OUTPUT_NAME ${example}) endforeach() + +if(SCORD_BUILD_TESTS) + add_test(ADM_register_job_c_test ADM_register_job ofi+tcp://127.0.0.1:52000) + + add_test(ADM_cancel_transfer_c_test ADM_cancel_transfer ofi+tcp://127.0.0.1:52000) + + add_test(ADM_connect_data_operation_c_test ADM_connect_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_define_data_operation_c_test ADM_define_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_deploy_adhoc_storage_c_test ADM_deploy_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_finalize_data_operation_c_test ADM_finalize_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_pending_transfers_c_test ADM_get_pending_transfers ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_qos_constraints_c_test ADM_get_qos_constraints ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_statistics_c_test ADM_get_statistics ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_transfer_priority_c_test ADM_get_transfer_priority ofi+tcp://127.0.0.1:52000) + + add_test(ADM_link_transfer_to_data_operation_c_test ADM_link_transfer_to_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_register_adhoc_storage_c_test ADM_register_adhoc_storage ofi+tcp://127.0.0.1:52000) + + # TODO: ADM_register_pfs_storage test is missing because is not working in cpp. + # Will be created when it works in cpp. + add_test(ADM_remove_adhoc_storage_c_test ADM_remove_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_remove_job_c_test ADM_remove_job ofi+tcp://127.0.0.1:52000) + + # TODO: ADM_remove_pfs_storage test is missing because is not working in cpp. + # Will be created when it works in cpp. + add_test(ADM_set_dataset_information_c_test ADM_set_dataset_information ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_io_resources_c_test ADM_set_io_resources ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_qos_constraints_c_test ADM_set_qos_constraints ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_transfer_priority_c_test ADM_set_transfer_priority ofi+tcp://127.0.0.1:52000) + + add_test(ADM_transfer_dataset_c_test ADM_transfer_dataset ofi+tcp://127.0.0.1:52000) + + add_test(ADM_update_adhoc_storage_c_test ADM_update_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_update_job_c_test ADM_update_job ofi+tcp://127.0.0.1:52000) + + # TODO: ADM_update_pfs_storage test is missing because is not working in cpp. + # Will be created when it works in cpp. +endif() diff --git a/examples/cxx/ADM_cancel_transfer.cpp b/examples/cxx/ADM_cancel_transfer.cpp index 966b0c1161ea813d87f93ade90f3084653b625b0..4543974f99bababf96c4014ba25d6a79bf9b783d 100644 --- a/examples/cxx/ADM_cancel_transfer.cpp +++ b/examples/cxx/ADM_cancel_transfer.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,21 +29,20 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, - "Usage: ADM_cancel_transfer \n"); + fmt::print(stderr, "Usage: ADM_cancel_transfer \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_transfer_t tx_handle{}; + ADM_transfer_t tx{}; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::cancel_transfer(server, job, tx_handle); + ret = admire::cancel_transfer(server, job, tx); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_cancel_transfer() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_connect_data_operation.cpp b/examples/cxx/ADM_connect_data_operation.cpp index b16c6c52227bac129e7e34954f2c399d9143a311..62614f9285521ce800c988fbe9917453ab09a648 100644 --- a/examples/cxx/ADM_connect_data_operation.cpp +++ b/examples/cxx/ADM_connect_data_operation.cpp @@ -1,26 +1,37 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include -bool -string_to_convert(std::string s) { - if(s == "true" || s == "TRUE" || s == "True") { - return true; - } else if(s == "false" || s == "FALSE" || s == "False") { - return false; - } else { - throw std::invalid_argument( - "ERROR: Incorrect input value. Please try again.\n"); - } -} - int main(int argc, char* argv[]) { - if(argc != 7) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_connect_data_operation \n"); + fmt::print(stderr, + "Usage: ADM_connect_data_operation \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_define_data_operation.cpp b/examples/cxx/ADM_define_data_operation.cpp index bd6cdf2dbc085b05891fd4af586771052566f9d2..1d2a0297363c79cd7ed894415039f0044663f22a 100644 --- a/examples/cxx/ADM_define_data_operation.cpp +++ b/examples/cxx/ADM_define_data_operation.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,25 +29,23 @@ int main(int argc, char* argv[]) { - if(argc != 5) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_define_data_operation \n"); + fmt::print(stderr, + "Usage: ADM_define_data_operation \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - const char* path = ""; - ADM_data_operation_t op_handle; + const char* path = "/tmpxxxxx"; + ADM_data_operation_t op; va_list args; // FIXME: placeholder ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::define_data_operation(server, job, path, &op_handle, - args); + ret = admire::define_data_operation(server, job, path, &op, args); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_define_data_operation() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_deploy_adhoc_storage.cpp b/examples/cxx/ADM_deploy_adhoc_storage.cpp index 9350fa5a15469162fc42415cd61e984076c00c96..f5badb35a4a58dd13f0f102ced1e4985f20ad2b6 100644 --- a/examples/cxx/ADM_deploy_adhoc_storage.cpp +++ b/examples/cxx/ADM_deploy_adhoc_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_deploy_adhoc_storage " - "\n"); + fmt::print(stderr, + "Usage: ADM_deploy_adhoc_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_finalize_data_operation.cpp b/examples/cxx/ADM_finalize_data_operation.cpp index da05c8d4b5397e567a284febe4b86b01e3e0dc20..c3eab90cb65330e23f348e2e4495751344695504 100644 --- a/examples/cxx/ADM_finalize_data_operation.cpp +++ b/examples/cxx/ADM_finalize_data_operation.cpp @@ -1,26 +1,49 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_finalize_data_operation \n"); + fmt::print(stderr, + "Usage: ADM_finalize_data_operation \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_data_operation_t op_handle{}; + ADM_data_operation_t op{}; ADM_data_operation_status_t status; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::finalize_data_operation(server, job, op_handle, &status); + ret = admire::finalize_data_operation(server, job, op, &status); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_finalize_data_operation() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_get_pending_transfers.cpp b/examples/cxx/ADM_get_pending_transfers.cpp index 3a146dad0cf6262980c7a9b75da98af7dd373d02..4d3c69f5fa7c6e054a42bec6ec92c5cd7fde0c7d 100644 --- a/examples/cxx/ADM_get_pending_transfers.cpp +++ b/examples/cxx/ADM_get_pending_transfers.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -7,18 +31,19 @@ main(int argc, char* argv[]) { if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_get_pending_transfers \n"); + fmt::print(stderr, + "Usage: ADM_get_pending_transfers \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_transfer_t** tx_handles = nullptr; + ADM_transfer_t** tx = nullptr; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::get_pending_transfers(server, job, tx_handles); + ret = admire::get_pending_transfers(server, job, tx); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_get_pending_transfers() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_get_qos_constraints.cpp b/examples/cxx/ADM_get_qos_constraints.cpp index da64bcbfdf99bfbdec40fd7a4dcdd40d8535db43..c1828aa46efcda74f096b04c911a4b5dc3139610 100644 --- a/examples/cxx/ADM_get_qos_constraints.cpp +++ b/examples/cxx/ADM_get_qos_constraints.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,11 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 4) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_get_qos_constraints \n"); + fmt::print(stderr, "Usage: ADM_get_qos_constraints \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_get_statistics.cpp b/examples/cxx/ADM_get_statistics.cpp index eccb9f8963806c7bfa0f0d92419e32c044fd0175..b3c78675240aa188f7be55e7336b84e07c7c5f2b 100644 --- a/examples/cxx/ADM_get_statistics.cpp +++ b/examples/cxx/ADM_get_statistics.cpp @@ -1,14 +1,36 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include int main(int argc, char* argv[]) { - if(argc != 4) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_get_statistics \n"); + fmt::print(stderr, "Usage: ADM_get_statistics \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_get_transfer_priority.cpp b/examples/cxx/ADM_get_transfer_priority.cpp index f52152d10129592d4b7934b890b4df9985d3c77d..8fef9925adc2a3ac8c70b683fa31b7928c290aa2 100644 --- a/examples/cxx/ADM_get_transfer_priority.cpp +++ b/examples/cxx/ADM_get_transfer_priority.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,23 +29,22 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_get_transfer_priority \n"); + fmt::print(stderr, + "Usage: ADM_get_transfer_priority \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_transfer_t tx_handle{}; + ADM_transfer_t tx{}; ADM_transfer_priority_t priority; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::get_transfer_priority(server, job, tx_handle, &priority); + ret = admire::get_transfer_priority(server, job, tx, &priority); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_get_transfer_priority() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_in_situ_ops.cpp b/examples/cxx/ADM_in_situ_ops.cpp index b870e6ec3a84205220bdd7d0073404baa32053db..517b0fd6ae59813ecc1293d0551fadcceea0ad9e 100644 --- a/examples/cxx/ADM_in_situ_ops.cpp +++ b/examples/cxx/ADM_in_situ_ops.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, - "Usage: ADM_in_situ_ops \n"); + fmt::print(stderr, "Usage: ADM_in_situ_ops \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_in_transit_ops.cpp b/examples/cxx/ADM_in_transit_ops.cpp index 4eef3e9496ea40980411d79c77a72ce481644a9b..bf3ce2b054d8abefc31f898ef91542828fccbb19 100644 --- a/examples/cxx/ADM_in_transit_ops.cpp +++ b/examples/cxx/ADM_in_transit_ops.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, - "Usage: ADM_in_transit_ops \n"); + fmt::print(stderr, "Usage: ADM_in_transit_ops \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_link_transfer_to_data_operation.cpp b/examples/cxx/ADM_link_transfer_to_data_operation.cpp index 623b640927cabbb7b8bd0fbe15d3c171d7d0379d..8ebb02c39d7007630583a4cabf0f61261eb0700b 100644 --- a/examples/cxx/ADM_link_transfer_to_data_operation.cpp +++ b/examples/cxx/ADM_link_transfer_to_data_operation.cpp @@ -1,27 +1,52 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include int main(int argc, char* argv[]) { - if(argc != 7) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); fmt::print( stderr, - "Usage: ADM_link_transfer_to_data_operation \n"); + "Usage: ADM_link_transfer_to_data_operation \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_data_operation_t op_handle{}; + ADM_data_operation_t op{}; bool should_stream = false; va_list args; + ADM_transfer_t transfer{}; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::link_transfer_to_data_operation(server, job, op_handle, + ret = admire::link_transfer_to_data_operation(server, job, op, transfer, should_stream, args); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_cancel_transfer() failed: {}\n", diff --git a/examples/cxx/ADM_register_adhoc_storage.cpp b/examples/cxx/ADM_register_adhoc_storage.cpp index f97aa69257198270e24698bd84c638ef09145384..2a61716940c33a1a3bf0ee1f9ef3519a35205094 100644 --- a/examples/cxx/ADM_register_adhoc_storage.cpp +++ b/examples/cxx/ADM_register_adhoc_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_register_adhoc_storage " - "\n"); + fmt::print(stderr, + "Usage: ADM_register_adhoc_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_register_job.cpp b/examples/cxx/ADM_register_job.cpp index cd31c15c307454e797adf0f56bddf498df19109b..8f3a149b95ee991e9cb0d75fe6acff3f76d71791 100644 --- a/examples/cxx/ADM_register_job.cpp +++ b/examples/cxx/ADM_register_job.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include diff --git a/examples/cxx/ADM_register_pfs_storage.cpp b/examples/cxx/ADM_register_pfs_storage.cpp index 0adafce845a0cefb86dfcf7faa5f6af6e8979b67..dc0c83148ece3d238f76f06fdb50f857284ac5a8 100644 --- a/examples/cxx/ADM_register_pfs_storage.cpp +++ b/examples/cxx/ADM_register_pfs_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_register_pfs_storage " - "\n"); + fmt::print(stderr, + "Usage: ADM_register_pfs_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_remove_adhoc_storage.cpp b/examples/cxx/ADM_remove_adhoc_storage.cpp index d622bf013368853f826d55eeac9e2577496471bd..9d6f2aea1ea0297567611eb6186072e33c296b92 100644 --- a/examples/cxx/ADM_remove_adhoc_storage.cpp +++ b/examples/cxx/ADM_remove_adhoc_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include "fmt/format.h" #include "admire.hpp" @@ -5,10 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_remove_adhoc_storage " - "\n"); + fmt::print(stderr, + "Usage: ADM_remove_adhoc_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_remove_job.cpp b/examples/cxx/ADM_remove_job.cpp index 55261e99e8caf0c64c97894e3fd7e74a0d6adbc9..682de21665d16ceb45ed017537aa7eba6ce0516c 100644 --- a/examples/cxx/ADM_remove_job.cpp +++ b/examples/cxx/ADM_remove_job.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include diff --git a/examples/cxx/ADM_remove_pfs_storage.cpp b/examples/cxx/ADM_remove_pfs_storage.cpp index 2df326ac53827a39a46cfc35ef4b190633d65905..ad05f50b3c8ca081c4ec5eb04cdd4ef8b80c2087 100644 --- a/examples/cxx/ADM_remove_pfs_storage.cpp +++ b/examples/cxx/ADM_remove_pfs_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include "fmt/format.h" #include "admire.hpp" @@ -5,10 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_remove_pfs_storage " - "\n"); + fmt::print(stderr, "Usage: ADM_remove_pfs_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_set_dataset_information.cpp b/examples/cxx/ADM_set_dataset_information.cpp index eeff1f012a93134ebd93fe8757b12ba00b72225c..3d1ac5ba7df4e3e58b1761e335d355d64f8da67c 100644 --- a/examples/cxx/ADM_set_dataset_information.cpp +++ b/examples/cxx/ADM_set_dataset_information.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,11 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 5) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_set_dataset_information \n"); + fmt::print(stderr, + "Usage: ADM_set_dataset_information \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_set_io_resources.cpp b/examples/cxx/ADM_set_io_resources.cpp index e4ee70a032aaa679a042fb902e4704a99c1d7f90..cf394845b8bc78f7660b0406c1e58171f16e0f5c 100644 --- a/examples/cxx/ADM_set_io_resources.cpp +++ b/examples/cxx/ADM_set_io_resources.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,11 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 5) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_set_io_resources \n"); + fmt::print(stderr, "Usage: ADM_set_io_resources \n"); exit(EXIT_FAILURE); } @@ -23,18 +45,18 @@ main(int argc, char* argv[]) { try { ret = admire::set_io_resources(server, job, tier, resources); } catch(const std::exception& e) { - fmt::print(stderr, "FATAL: ADM_cancel_transfer() failed: {}\n", + fmt::print(stderr, "FATAL: ADM_set_io_resources() failed: {}\n", e.what()); exit(EXIT_FAILURE); } if(ret != ADM_SUCCESS) { fmt::print(stdout, - "ADM_cancel_transfer() remote procedure not completed " + "ADM_set_io_resources() remote procedure not completed " "successfully\n"); exit(EXIT_FAILURE); } - fmt::print(stdout, "ADM_cancel_transfer() remote procedure completed " + fmt::print(stdout, "ADM_set_io_resources() remote procedure completed " "successfully\n"); } diff --git a/examples/cxx/ADM_set_qos_constraints.cpp b/examples/cxx/ADM_set_qos_constraints.cpp index cdd50a89c0947f08a151f2b5c81beef94e9565e4..3b3f84fe44406033a5073fb3dcc98fd0690aacba 100644 --- a/examples/cxx/ADM_set_qos_constraints.cpp +++ b/examples/cxx/ADM_set_qos_constraints.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,11 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 6) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_set_qos_constraints \n"); + fmt::print(stderr, "Usage: ADM_set_qos_constraints \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_set_transfer_priority.cpp b/examples/cxx/ADM_set_transfer_priority.cpp index 516a9159a687b16ed9788d09dd1e40191a68fd6f..f9fe2e69f714cfba409afa600e9be78c6d307b06 100644 --- a/examples/cxx/ADM_set_transfer_priority.cpp +++ b/examples/cxx/ADM_set_transfer_priority.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,23 +29,22 @@ int main(int argc, char* argv[]) { - if(argc != 4) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_set_transfer_priority \n"); + fmt::print(stderr, + "Usage: ADM_set_transfer_priority \n"); exit(EXIT_FAILURE); } admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_transfer_t tx_handle{}; + ADM_transfer_t tx{}; int incr = 42; ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::set_transfer_priority(server, job, tx_handle, incr); + ret = admire::set_transfer_priority(server, job, tx, incr); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_set_transfer_priority() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_transfer_dataset.cpp b/examples/cxx/ADM_transfer_dataset.cpp index 0c736284f2b5b114d63b19dcf9dcdf43bcf0fd84..1eb3f2c56b4ba9d51f708ee102668a3d34036966 100644 --- a/examples/cxx/ADM_transfer_dataset.cpp +++ b/examples/cxx/ADM_transfer_dataset.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,12 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 7) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print( - stderr, - "Usage: ADM_transfer_dataset " - " \n"); + fmt::print(stderr, "Usage: ADM_transfer_dataset \n"); exit(EXIT_FAILURE); } @@ -21,12 +42,12 @@ main(int argc, char* argv[]) { ADM_dataset_t** targets = nullptr; ADM_qos_limit_t** limits = nullptr; ADM_transfer_mapping_t mapping = ADM_MAPPING_ONE_TO_ONE; - ADM_transfer_t tx_handle{}; + ADM_transfer_t tx{}; ADM_return_t ret = ADM_SUCCESS; try { ret = admire::transfer_dataset(server, job, sources, targets, limits, - mapping, &tx_handle); + mapping, &tx); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_cancel_transfer() failed: {}\n", e.what()); diff --git a/examples/cxx/ADM_update_adhoc_storage.cpp b/examples/cxx/ADM_update_adhoc_storage.cpp index 2d43d7df40390ac5130f51997f593dc5574b7af7..8b9debd3851ab123ec71f74e01c604480ca9031e 100644 --- a/examples/cxx/ADM_update_adhoc_storage.cpp +++ b/examples/cxx/ADM_update_adhoc_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,10 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_update_adhoc_storage " - "\n"); + fmt::print(stderr, + "Usage: ADM_update_adhoc_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_update_job.cpp b/examples/cxx/ADM_update_job.cpp index a82a2dae19ca2929d17abc866b8ddadbf1461cc9..14846cc2b4f05c1a384f5887876365a621add949 100644 --- a/examples/cxx/ADM_update_job.cpp +++ b/examples/cxx/ADM_update_job.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -32,14 +56,45 @@ main(int argc, char* argv[]) { admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, 42, 100, false); - admire::job job{42}; admire::job_requirements reqs{inputs, outputs, std::move(p)}; + + + std::vector new_inputs; + new_inputs.reserve(NINPUTS); + for(int i = 0; i < NINPUTS; ++i) { + new_inputs.emplace_back(fmt::format("input-new-dataset-{}", i)); + } + + std::vector new_outputs; + new_outputs.reserve(NOUTPUTS); + for(int i = 0; i < NOUTPUTS; ++i) { + new_outputs.emplace_back(fmt::format("output-new-dataset-{}", i)); + } + + auto p2 = std::make_unique( + admire::storage::type::gekkofs, "foobar", + admire::adhoc_storage::execution_mode::separate_new, + admire::adhoc_storage::access_type::read_write, 42, 100, false); + + admire::job_requirements new_reqs{new_inputs, new_outputs, std::move(p2)}; + + ADM_return_t ret = ADM_SUCCESS; try { - ret = admire::update_job(server, job, reqs); + [[maybe_unused]] const auto job = admire::register_job(server, reqs); + + ret = admire::update_job(server, job, new_reqs); + + fmt::print( + stdout, + "ADM_register_job() and ADM_update_job() remote procedure completed " + "successfully\n"); + exit(EXIT_SUCCESS); } catch(const std::exception& e) { - fmt::print(stderr, "FATAL: ADM_update_job() failed: {}\n", e.what()); + fmt::print(stderr, + "FATAL: ADM_register_job() or ADM_update_job() failed: {}\n", + e.what()); exit(EXIT_FAILURE); } @@ -48,7 +103,4 @@ main(int argc, char* argv[]) { "successfully\n"); exit(EXIT_FAILURE); } - - fmt::print(stdout, "ADM_update_job() remote procedure completed " - "successfully\n"); } diff --git a/examples/cxx/ADM_update_pfs_storage.cpp b/examples/cxx/ADM_update_pfs_storage.cpp index f8be25691d1cd0b3b03c0302cd0d95f74c2cd8c4..e09173d58749df4f51c427c86b4124e9e520353f 100644 --- a/examples/cxx/ADM_update_pfs_storage.cpp +++ b/examples/cxx/ADM_update_pfs_storage.cpp @@ -1,3 +1,27 @@ +/****************************************************************************** + * Copyright 2021, Barcelona Supercomputing Center (BSC), Spain + * + * This software was partially supported by the EuroHPC-funded project ADMIRE + * (Project ID: 956748, https://www.admire-eurohpc.eu). + * + * This file is part of scord. + * + * scord is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * scord is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scord. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + *****************************************************************************/ + #include #include @@ -5,10 +29,9 @@ int main(int argc, char* argv[]) { - if(argc != 3) { + if(argc != 2) { fmt::print(stderr, "ERROR: no location provided\n"); - fmt::print(stderr, "Usage: ADM_update_pfs_storage " - "\n"); + fmt::print(stderr, "Usage: ADM_update_pfs_storage \n"); exit(EXIT_FAILURE); } diff --git a/examples/cxx/CMakeLists.txt b/examples/cxx/CMakeLists.txt index 1ee8d2d57ba07432a76a517ec9423ef4ae0fc747..ec8d44092afd9b75fd2ba431fe76598733aaff14 100644 --- a/examples/cxx/CMakeLists.txt +++ b/examples/cxx/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright 2021-2022, Barcelona Supercomputing Center (BSC), Spain # +# Copyright 2021, Barcelona Supercomputing Center (BSC), Spain # # # # This software was partially supported by the EuroHPC-funded project ADMIRE # # (Project ID: 956748, https://www.admire-eurohpc.eu). # @@ -23,23 +23,71 @@ ################################################################################ list(APPEND examples_cxx - ADM_ping - ADM_register_job ADM_update_job ADM_remove_job - ADM_register_adhoc_storage ADM_update_adhoc_storage - ADM_remove_adhoc_storage ADM_deploy_adhoc_storage - ADM_register_pfs_storage ADM_update_pfs_storage - ADM_remove_pfs_storage - # ADM_in_situ_ops ADM_in_transit_ops - ADM_transfer_dataset - ADM_set_dataset_information ADM_set_io_resources ADM_get_transfer_priority - ADM_set_transfer_priority ADM_cancel_transfer ADM_get_pending_transfers - ADM_set_qos_constraints ADM_get_qos_constraints ADM_define_data_operation ADM_connect_data_operation - ADM_finalize_data_operation ADM_link_transfer_to_data_operation ADM_get_statistics) - -foreach (example IN LISTS examples_cxx) - add_executable(${example}_cxx) - target_sources(${example}_cxx PRIVATE ${example}.cpp) - target_link_libraries(${example}_cxx - PUBLIC common::network::engine fmt::fmt adm_iosched) - set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example}) + ADM_ping + ADM_register_job ADM_update_job ADM_remove_job + ADM_register_adhoc_storage ADM_update_adhoc_storage + ADM_remove_adhoc_storage ADM_deploy_adhoc_storage + ADM_register_pfs_storage ADM_update_pfs_storage + ADM_remove_pfs_storage + + # ADM_in_situ_ops ADM_in_transit_ops + ADM_transfer_dataset + ADM_set_dataset_information ADM_set_io_resources ADM_get_transfer_priority + ADM_set_transfer_priority ADM_cancel_transfer ADM_get_pending_transfers + ADM_set_qos_constraints ADM_get_qos_constraints ADM_define_data_operation ADM_connect_data_operation + ADM_finalize_data_operation ADM_link_transfer_to_data_operation ADM_get_statistics) + +foreach(example IN LISTS examples_cxx) + add_executable(${example}_cxx) + target_sources(${example}_cxx PRIVATE ${example}.cpp) + target_link_libraries(${example}_cxx + PUBLIC common::network::engine fmt::fmt adm_iosched) + set_target_properties(${example}_cxx PROPERTIES OUTPUT_NAME ${example}) endforeach() + +if(SCORD_BUILD_TESTS) + add_test(ADM_ping_test ADM_ping ofi+tcp://127.0.0.1:52000) + + add_test(ADM_cancel_transfer_cxx_test ADM_cancel_transfer ofi+tcp://127.0.0.1:52000) + set_tests_properties(ADM_cancel_transfer_cxx_test PROPERTIES LABELS "ADM_cancel_transfer;cxx") + + add_test(ADM_connect_data_operation_cxx_test ADM_connect_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_define_data_operation_cxx_test ADM_define_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_deploy_adhoc_storage_cxx_test ADM_deploy_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_finalize_data_operation_cxx_test ADM_finalize_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_pending_transfers_cxx_test ADM_get_pending_transfers ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_qos_constraints_cxx_test ADM_get_qos_constraints ofi+tcp://127.0.0.1:52000) + + add_test(ADM_get_transfer_priority_cxx_test ADM_get_transfer_priority ofi+tcp://127.0.0.1:52000) + + add_test(ADM_link_transfer_to_data_operation_cxx_test ADM_link_transfer_to_data_operation ofi+tcp://127.0.0.1:52000) + + add_test(ADM_register_job_cxx_test ADM_register_job ofi+tcp://127.0.0.1:52000) + + # TODO: add_test(ADM_register_pfs_storage_test ADM_register_pfs_storage ofi+tcp://127.0.0.1:52000) + add_test(ADM_remove_adhoc_storage_cxx_test ADM_remove_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_remove_job_cxx_test ADM_remove_job ofi+tcp://127.0.0.1:52000) + + # TODO: add_test(ADM_remove_pfs_storage_test ADM_remove_pfs_storage ofi+tcp://127.0.0.1:52000 42) + add_test(ADM_set_dataset_information_cxx_test ADM_set_dataset_information ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_io_resources_cxx_test ADM_set_io_resources ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_qos_constraints_cxx_test ADM_set_qos_constraints ofi+tcp://127.0.0.1:52000) + + add_test(ADM_set_transfer_priority_cxx_test ADM_set_transfer_priority ofi+tcp://127.0.0.1:52000) + + add_test(ADM_transfer_dataset_cxx_test ADM_transfer_dataset ofi+tcp://127.0.0.1:52000) + + add_test(ADM_update_adhoc_storage_cxx_test ADM_update_adhoc_storage ofi+tcp://127.0.0.1:52000) + + add_test(ADM_update_job_cxx_test ADM_update_job ofi+tcp://127.0.0.1:52000) + + # TODO: add_test(ADM_update_pfs_storage_cxx_test ADM_update_pfs_storage ofi+tcp://127.0.0.1:52000 42) +endif() diff --git a/src/common/net/engine.hpp b/src/common/net/engine.hpp index c241f8a130e1ea294387bfa0d2b88e768413366e..cb31008086cf6f2d2b00d5bcbe9be64f38a7fb2a 100644 --- a/src/common/net/engine.hpp +++ b/src/common/net/engine.hpp @@ -126,6 +126,35 @@ struct engine { std::shared_ptr m_context; }; +template +class rpc_handle { +public: + rpc_handle(hg_handle_t handle, Output output) + : m_handle(handle), m_output(output) {} + + ~rpc_handle() { + + if(m_handle) { + + if(m_output) { + margo_free_output(m_handle, m_output); + } + + margo_destroy(m_handle); + } + } + + hg_handle_t + native() { + return m_handle; + } + +private: + hg_handle_t m_handle; + Output m_output; +}; + + struct endpoint { private: // Endpoints should only be created by calling engine::lookup() @@ -186,7 +215,7 @@ public: * **/ template - void + [[nodiscard]] rpc_handle call(const std::string& id, T1 input = nullptr, T2 output = nullptr) { const auto it = m_margo_context->m_rpc_names.find(id); @@ -218,14 +247,7 @@ public: ret = ::margo_get_output(handle, output); } - - ret = ::margo_destroy(handle); - - if(ret != HG_SUCCESS) { - throw std::runtime_error( - fmt::format("Error during endpoint::call(): {}", - ::HG_Error_to_string(ret))); - } + return rpc_handle{handle, output}; } private: diff --git a/src/lib/admire.cpp b/src/lib/admire.cpp index 73aa60ac6d2bcc6915bbfc7bc435cf68d25dd1b1..8854823daf5d8da0ba259dd169656a8789258b6b 100644 --- a/src/lib/admire.cpp +++ b/src/lib/admire.cpp @@ -230,7 +230,7 @@ register_adhoc_storage(const server& srv, ADM_job_t job, ADM_register_adhoc_storage_in_t in{}; ADM_register_adhoc_storage_out_t out; - endp.call("ADM_register_adhoc_storage", &in, &out); + const auto rpc = endp.call("ADM_register_adhoc_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_register_adhoc_storage() = {}", out.ret); @@ -258,7 +258,7 @@ update_adhoc_storage(const server& srv, ADM_job_t job, ADM_adhoc_context_t ctx, ADM_update_adhoc_storage_in_t in{}; ADM_update_adhoc_storage_out_t out; - endp.call("ADM_update_adhoc_storage", &in, &out); + const auto rpc = endp.call("ADM_update_adhoc_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_update_adhoc_storage() = {}", out.ret); @@ -285,7 +285,7 @@ remove_adhoc_storage(const server& srv, ADM_job_t job, ADM_remove_adhoc_storage_in_t in{}; ADM_remove_adhoc_storage_out_t out; - endp.call("ADM_remove_adhoc_storage", &in, &out); + const auto rpc = endp.call("ADM_remove_adhoc_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_remove_adhoc_storage() = {}", out.ret); @@ -312,7 +312,7 @@ deploy_adhoc_storage(const server& srv, ADM_job_t job, ADM_deploy_adhoc_storage_in_t in{}; ADM_deploy_adhoc_storage_out_t out; - endp.call("ADM_deploy_adhoc_storage", &in, &out); + const auto rpc = endp.call("ADM_deploy_adhoc_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_deploy_adhoc_storage() = {}", out.ret); @@ -340,7 +340,7 @@ register_pfs_storage(const server& srv, ADM_job_t job, ADM_pfs_context_t ctx, ADM_register_pfs_storage_in_t in{}; ADM_register_pfs_storage_out_t out; - endp.call("ADM_register_pfs_storage", &in, &out); + const auto rpc = endp.call("ADM_register_pfs_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_register_pfs_storage() = {}", out.ret); @@ -368,7 +368,7 @@ update_pfs_storage(const server& srv, ADM_job_t job, ADM_pfs_context_t ctx, ADM_update_pfs_storage_in_t in{}; ADM_update_pfs_storage_out_t out; - endp.call("ADM_update_pfs_storage", &in, &out); + const auto rpc = endp.call("ADM_update_pfs_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_update_pfs_storage() = {}", out.ret); @@ -395,7 +395,7 @@ remove_pfs_storage(const server& srv, ADM_job_t job, ADM_remove_pfs_storage_in_t in{}; ADM_remove_pfs_storage_out_t out; - endp.call("ADM_remove_pfs_storage", &in, &out); + const auto rpc = endp.call("ADM_remove_pfs_storage", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_remove_pfs_storage() = {}", out.ret); @@ -427,7 +427,12 @@ transfer_dataset(const server& srv, ADM_job_t job, ADM_dataset_t** sources, ADM_transfer_dataset_in_t in{}; ADM_transfer_dataset_out_t out; - endp.call("ADM_transfer_dataset", &in, &out); + in.source = "/tmp"; + in.destination = "/tmp"; + in.qos_constraints = "constraints"; + in.distribution = "distribution"; + + const auto rpc = endp.call("ADM_transfer_dataset", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_transfer_dataset() = {}", out.ret); @@ -455,7 +460,9 @@ set_dataset_information(const server& srv, ADM_job_t job, ADM_dataset_t target, ADM_set_dataset_information_in_t in{}; ADM_set_dataset_information_out_t out; - endp.call("ADM_set_dataset_information", &in, &out); + in.info = "info"; + + const auto rpc = endp.call("ADM_set_dataset_information", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_set_dataset_information() = {}", out.ret); @@ -483,7 +490,9 @@ set_io_resources(const server& srv, ADM_job_t job, ADM_storage_t tier, ADM_set_io_resources_in_t in{}; ADM_set_io_resources_out_t out; - endp.call("ADM_set_io_resources", &in, &out); + in.resources = "resources"; + + const auto rpc = endp.call("ADM_set_io_resources", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_set_io_resources() = {}", out.ret); @@ -511,7 +520,7 @@ get_transfer_priority(const server& srv, ADM_job_t job, ADM_transfer_t transfer, ADM_get_transfer_priority_in_t in{}; ADM_get_transfer_priority_out_t out; - endp.call("ADM_get_transfer_priority", &in, &out); + const auto rpc = endp.call("ADM_get_transfer_priority", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_get_transfer_priority() = {}", out.ret); @@ -539,7 +548,7 @@ set_transfer_priority(const server& srv, ADM_job_t job, ADM_transfer_t transfer, ADM_set_transfer_priority_in_t in{}; ADM_set_transfer_priority_out_t out; - endp.call("ADM_set_transfer_priority", &in, &out); + const auto rpc = endp.call("ADM_set_transfer_priority", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_set_transfer_priority() = {}", out.ret); @@ -566,7 +575,7 @@ cancel_transfer(const server& srv, ADM_job_t job, ADM_transfer_t transfer) { ADM_cancel_transfer_in_t in{42}; ADM_cancel_transfer_out_t out; - endp.call("ADM_cancel_transfer", &in, &out); + const auto rpc = endp.call("ADM_cancel_transfer", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_cancel_transfer() = {}", out.ret); @@ -594,7 +603,7 @@ get_pending_transfers(const server& srv, ADM_job_t job, ADM_get_pending_transfers_in_t in{}; ADM_get_pending_transfers_out_t out; - endp.call("ADM_get_pending_transfers", &in, &out); + const auto rpc = endp.call("ADM_get_pending_transfers", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_get_pending_transfers() = {}", out.ret); @@ -623,7 +632,11 @@ set_qos_constraints(const server& srv, ADM_job_t job, ADM_qos_entity_t entity, ADM_set_qos_constraints_in_t in{}; ADM_set_qos_constraints_out_t out; - endp.call("ADM_set_qos_constraints", &in, &out); + in.scope = "dataset"; + in.qos_class = "class"; + in.class_value = "value"; + + const auto rpc = endp.call("ADM_set_qos_constraints", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_set_qos_constraints() = {}", out.ret); @@ -652,7 +665,9 @@ get_qos_constraints(const server& srv, ADM_job_t job, ADM_qos_entity_t entity, ADM_get_qos_constraints_in_t in{}; ADM_get_qos_constraints_out_t out; - endp.call("ADM_get_qos_constraints", &in, &out); + in.scope = "dataset"; + + const auto rpc = endp.call("ADM_get_qos_constraints", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_get_qos_constraints() = {}", out.ret); @@ -682,7 +697,11 @@ define_data_operation(const server& srv, ADM_job_t job, const char* path, ADM_define_data_operation_in_t in{}; ADM_define_data_operation_out_t out; - endp.call("ADM_define_data_operation", &in, &out); + in.path = path; + in.operation_id = 1; + in.arguments = "argument1 argument2"; + + const auto rpc = endp.call("ADM_define_data_operation", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_define_data_operation() = {}", out.ret); @@ -713,7 +732,10 @@ connect_data_operation(const server& srv, ADM_job_t job, ADM_dataset_t input, ADM_connect_data_operation_in_t in{}; ADM_connect_data_operation_out_t out; - endp.call("ADM_connect_data_operation", &in, &out); + in.input = "/tmp"; + in.arguments = "argument1 argument2"; + + const auto rpc = endp.call("ADM_connect_data_operation", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_connect_data_operation() = {}", out.ret); @@ -743,7 +765,7 @@ finalize_data_operation(const server& srv, ADM_job_t job, ADM_finalize_data_operation_in_t in{}; ADM_finalize_data_operation_out_t out; - endp.call("ADM_finalize_data_operation", &in, &out); + const auto rpc = endp.call("ADM_finalize_data_operation", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_finalize_data_operation() = {}", out.ret); @@ -756,13 +778,15 @@ finalize_data_operation(const server& srv, ADM_job_t job, ADM_return_t link_transfer_to_data_operation(const server& srv, ADM_job_t job, - ADM_data_operation_t op, bool should_stream, + ADM_data_operation_t op, + ADM_transfer_t transfer, bool should_stream, va_list args) { (void) srv; (void) job; (void) op; (void) should_stream; (void) args; + (void) transfer; scord::network::rpc_client rpc_client{srv.protocol(), rpc_registration_cb}; @@ -774,7 +798,10 @@ link_transfer_to_data_operation(const server& srv, ADM_job_t job, ADM_link_transfer_to_data_operation_in_t in{}; ADM_link_transfer_to_data_operation_out_t out; - endp.call("ADM_link_transfer_to_data_operation", &in, &out); + in.arguments = "argument1 argument2"; + + const auto rpc = + endp.call("ADM_link_transfer_to_data_operation", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_link_transfer_to_data_operation() = {}", out.ret); @@ -801,7 +828,7 @@ get_statistics(const server& srv, ADM_job_t job, ADM_job_stats_t** stats) { ADM_get_statistics_in_t in{}; ADM_get_statistics_out_t out; - endp.call("ADM_get_statistics", &in, &out); + const auto rpc = endp.call("ADM_get_statistics", &in, &out); if(out.ret < 0) { LOGGER_ERROR("ADM_get_statistics() = {}", out.ret); diff --git a/src/lib/admire.hpp b/src/lib/admire.hpp index 9aacc72a4dcc1f29351736faec1d7aee35bb2ffb..003af7cbed1c0cde7b3545b1f299157936b64678 100644 --- a/src/lib/admire.hpp +++ b/src/lib/admire.hpp @@ -134,7 +134,7 @@ finalize_data_operation(const server& srv, ADM_job_t job, ADM_return_t link_transfer_to_data_operation(const server& srv, ADM_job_t job, - ADM_data_operation_t op, bool should_stream, + ADM_data_operation_t op, ADM_transfer_t transfer, bool should_stream, va_list args); ADM_return_t diff --git a/src/lib/c_wrapper.cpp b/src/lib/c_wrapper.cpp index f150358b3665f2918f47675b4810a14c25427694..58dfadc29ecafa13ba5d4316144d3549b7c256cf 100644 --- a/src/lib/c_wrapper.cpp +++ b/src/lib/c_wrapper.cpp @@ -267,16 +267,18 @@ ADM_finalize_data_operation(ADM_server_t server, ADM_job_t job, return admire::finalize_data_operation(srv, job, op, status); } + ADM_return_t ADM_link_transfer_to_data_operation(ADM_server_t server, ADM_job_t job, - ADM_data_operation_t op, bool should_stream, + ADM_data_operation_t op, + ADM_transfer_t transfer, bool should_stream, ...) { const admire::server srv{server}; va_list args; va_start(args, should_stream); - auto ret = admire::link_transfer_to_data_operation(srv, job, op, + auto ret = admire::link_transfer_to_data_operation(srv, job, op, transfer, should_stream, args); va_end(args); diff --git a/src/lib/detail/impl.cpp b/src/lib/detail/impl.cpp index e8092a471e3bac46423346c4f301f22f1a83bb98..803e6252330c0630332fa73567863ea34cbafab4 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -164,7 +164,7 @@ ping(const server& srv) { auto endp = rpc_client.lookup(srv.address()); LOGGER_INFO("ADM_ping()"); - endp.call("ADM_ping"); + const auto rpc = endp.call("ADM_ping"); LOGGER_INFO("ADM_register_job() = {}", ADM_SUCCESS); return ADM_SUCCESS; @@ -185,7 +185,7 @@ register_job(const admire::server& srv, const admire::job_requirements& reqs) { ADM_register_job_in_t in{*rpc_reqs.get()}; ADM_register_job_out_t out; - endp.call("ADM_register_job", &in, &out); + const auto rpc = endp.call("ADM_register_job", &in, &out); if(out.retval < 0) { LOGGER_ERROR("RPC (ADM_{}) <= {}", __FUNCTION__, out.retval); @@ -216,7 +216,7 @@ update_job(const server& srv, const job& job, const job_requirements& reqs) { ADM_update_job_in_t in{rpc_job.get(), *rpc_reqs.get()}; ADM_update_job_out_t out; - endp.call("ADM_update_job", &in, &out); + const auto rpc = endp.call("ADM_update_job", &in, &out); if(out.retval < 0) { @@ -243,7 +243,7 @@ remove_job(const server& srv, const job& job) { ADM_remove_job_in_t in{rpc_job.get()}; ADM_remove_job_out_t out; - endp.call("ADM_remove_job", &in, &out); + const auto rpc = endp.call("ADM_remove_job", &in, &out); if(out.retval < 0) { const auto retval = static_cast(out.retval); diff --git a/src/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index af3f157e1193cbe906de1cfdb888124fa7e1e24c..a12d812d48d452bd4f4522841f705cba8793d297 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -75,7 +75,7 @@ ADM_register_job(hg_handle_t h) { admire::error_code rv = ADM_SUCCESS; out.retval = rv; - out.job = admire::api::convert(job).get(); + out.job = admire::api::convert(job).release(); LOGGER_INFO("RPC ID {} ({}) => {{retval: {}, job: {{{}}}}}", id, __FUNCTION__, rv, job);