From baa03b1015ae751bb558ad8053f1eec1e6197956 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Fri, 7 Oct 2022 21:03:32 +0200 Subject: [PATCH] ADM_register_adhoc_storage: Remove unused ADM_job_t arg --- examples/c/ADM_deploy_adhoc_storage.c | 19 ++----------------- examples/c/ADM_register_adhoc_storage.c | 19 ++----------------- examples/c/ADM_remove_adhoc_storage.c | 19 ++----------------- examples/c/ADM_update_adhoc_storage.c | 20 ++------------------ examples/cxx/ADM_register_adhoc_storage.cpp | 19 +++++-------------- src/common/net/proto/rpc_types.h | 1 - src/lib/admire.cpp | 5 ++--- src/lib/admire.h | 5 ++--- src/lib/admire.hpp | 3 +-- src/lib/c_wrapper.cpp | 6 +++--- src/lib/detail/impl.cpp | 11 ++++------- src/lib/detail/impl.hpp | 2 +- src/scord/rpc_handlers.cpp | 5 ++--- 13 files changed, 28 insertions(+), 106 deletions(-) diff --git a/examples/c/ADM_deploy_adhoc_storage.c b/examples/c/ADM_deploy_adhoc_storage.c index a882a80e..37fb1e4e 100644 --- a/examples/c/ADM_deploy_adhoc_storage.c +++ b/examples/c/ADM_deploy_adhoc_storage.c @@ -28,7 +28,6 @@ #include #include "common.h" -#define NJOB_NODES 50 #define NADHOC_NODES 25 #define NINPUTS 10 #define NOUTPUTS 5 @@ -45,9 +44,6 @@ main(int argc, char* argv[]) { int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); - ADM_job_t job; - ADM_node_t* job_nodes = prepare_nodes(NJOB_NODES); - assert(job_nodes); ADM_node_t* adhoc_nodes = prepare_nodes(NADHOC_NODES); assert(adhoc_nodes); ADM_dataset_t* inputs = prepare_datasets("input-dataset-%d", NINPUTS); @@ -55,10 +51,6 @@ main(int argc, char* argv[]) { ADM_dataset_t* outputs = prepare_datasets("output-dataset-%d", NOUTPUTS); assert(outputs); - ADM_job_resources_t job_resources = - ADM_job_resources_create(job_nodes, NJOB_NODES); - assert(job_resources); - ADM_adhoc_resources_t adhoc_resources = ADM_adhoc_resources_create(adhoc_nodes, NADHOC_NODES); assert(adhoc_resources); @@ -75,18 +67,11 @@ main(int argc, char* argv[]) { ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); assert(reqs); - ADM_return_t ret = ADM_register_job(server, job_resources, reqs, &job); - - if(ret != ADM_SUCCESS) { - fprintf(stdout, "ADM_register_job() remote procedure not completed " - "successfully\n"); - exit_status = EXIT_FAILURE; - } - const char* user_id = "adhoc_storage_42"; ADM_storage_t adhoc_storage; - ret = ADM_register_adhoc_storage(server, job, user_id, ctx, &adhoc_storage); + ADM_return_t ret = + ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_register_adhoc_storage.c b/examples/c/ADM_register_adhoc_storage.c index e6b7865e..9b859d4e 100644 --- a/examples/c/ADM_register_adhoc_storage.c +++ b/examples/c/ADM_register_adhoc_storage.c @@ -29,7 +29,6 @@ #include "common.h" #define NADHOC_NODES 25 -#define NJOB_NODES 50 #define NINPUTS 10 #define NOUTPUTS 5 @@ -45,9 +44,6 @@ main(int argc, char* argv[]) { int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); - ADM_job_t job; - ADM_node_t* job_nodes = prepare_nodes(NJOB_NODES); - assert(job_nodes); ADM_node_t* adhoc_nodes = prepare_nodes(NADHOC_NODES); assert(adhoc_nodes); ADM_dataset_t* inputs = prepare_datasets("input-dataset-%d", NINPUTS); @@ -55,10 +51,6 @@ main(int argc, char* argv[]) { ADM_dataset_t* outputs = prepare_datasets("output-dataset-%d", NOUTPUTS); assert(outputs); - ADM_job_resources_t job_resources = - ADM_job_resources_create(job_nodes, NJOB_NODES); - assert(job_resources); - ADM_adhoc_resources_t adhoc_resources = ADM_adhoc_resources_create(adhoc_nodes, NADHOC_NODES); assert(adhoc_resources); @@ -75,18 +67,11 @@ main(int argc, char* argv[]) { ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); assert(reqs); - ADM_return_t ret = ADM_register_job(server, job_resources, reqs, &job); - - if(ret != ADM_SUCCESS) { - fprintf(stdout, "ADM_register_job() remote procedure not completed " - "successfully\n"); - exit_status = EXIT_FAILURE; - } - const char* user_id = "adhoc_storage_42"; ADM_storage_t adhoc_storage; - ret = ADM_register_adhoc_storage(server, job, user_id, ctx, &adhoc_storage); + ADM_return_t ret = + ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_remove_adhoc_storage.c b/examples/c/ADM_remove_adhoc_storage.c index 95826ebd..45422b93 100644 --- a/examples/c/ADM_remove_adhoc_storage.c +++ b/examples/c/ADM_remove_adhoc_storage.c @@ -28,7 +28,6 @@ #include #include "common.h" -#define NJOB_NODES 50 #define NADHOC_NODES 25 #define NINPUTS 10 #define NOUTPUTS 5 @@ -45,9 +44,6 @@ main(int argc, char* argv[]) { int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); - ADM_job_t job; - ADM_node_t* job_nodes = prepare_nodes(NJOB_NODES); - assert(job_nodes); ADM_node_t* adhoc_nodes = prepare_nodes(NADHOC_NODES); assert(adhoc_nodes); ADM_dataset_t* inputs = prepare_datasets("input-dataset-%d", NINPUTS); @@ -55,10 +51,6 @@ main(int argc, char* argv[]) { ADM_dataset_t* outputs = prepare_datasets("output-dataset-%d", NOUTPUTS); assert(outputs); - ADM_job_resources_t job_resources = - ADM_job_resources_create(job_nodes, NJOB_NODES); - assert(job_resources); - ADM_adhoc_resources_t adhoc_resources = ADM_adhoc_resources_create(adhoc_nodes, NADHOC_NODES); assert(adhoc_resources); @@ -75,18 +67,11 @@ main(int argc, char* argv[]) { ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); assert(reqs); - ADM_return_t ret = ADM_register_job(server, job_resources, reqs, &job); - - if(ret != ADM_SUCCESS) { - fprintf(stdout, "ADM_register_job() remote procedure not completed " - "successfully\n"); - exit_status = EXIT_FAILURE; - } - const char* user_id = "adhoc_storage_42"; ADM_storage_t adhoc_storage; - ret = ADM_register_adhoc_storage(server, job, user_id, ctx, &adhoc_storage); + ADM_return_t ret = + ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_update_adhoc_storage.c b/examples/c/ADM_update_adhoc_storage.c index bd876193..e02a8033 100644 --- a/examples/c/ADM_update_adhoc_storage.c +++ b/examples/c/ADM_update_adhoc_storage.c @@ -28,7 +28,6 @@ #include #include "common.h" -#define NJOB_NODES 50 #define NADHOC_NODES 25 #define NINPUTS 10 #define NOUTPUTS 5 @@ -45,9 +44,6 @@ main(int argc, char* argv[]) { int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); - ADM_job_t job; - ADM_node_t* job_nodes = prepare_nodes(NJOB_NODES); - assert(job_nodes); ADM_node_t* adhoc_nodes = prepare_nodes(NADHOC_NODES); assert(adhoc_nodes); ADM_dataset_t* inputs = prepare_datasets("input-dataset-%d", NINPUTS); @@ -55,10 +51,6 @@ main(int argc, char* argv[]) { ADM_dataset_t* outputs = prepare_datasets("output-dataset-%d", NOUTPUTS); assert(outputs); - ADM_job_resources_t job_resources = - ADM_job_resources_create(job_nodes, NJOB_NODES); - assert(job_resources); - ADM_adhoc_resources_t adhoc_resources = ADM_adhoc_resources_create(adhoc_nodes, NADHOC_NODES); assert(adhoc_resources); @@ -75,19 +67,11 @@ main(int argc, char* argv[]) { ADM_job_requirements_create(inputs, NINPUTS, outputs, NOUTPUTS, st); assert(reqs); - ADM_return_t ret = ADM_register_job(server, job_resources, reqs, &job); - - if(ret != ADM_SUCCESS) { - fprintf(stdout, "ADM_register_job() remote procedure not completed " - "successfully\n"); - exit_status = EXIT_FAILURE; - goto cleanup; - } - const char* user_id = "adhoc_storage_42"; ADM_storage_t adhoc_storage; - ret = ADM_register_adhoc_storage(server, job, user_id, ctx, &adhoc_storage); + ADM_return_t ret = + ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/cxx/ADM_register_adhoc_storage.cpp b/examples/cxx/ADM_register_adhoc_storage.cpp index 542acad2..8e91fb73 100644 --- a/examples/cxx/ADM_register_adhoc_storage.cpp +++ b/examples/cxx/ADM_register_adhoc_storage.cpp @@ -61,28 +61,19 @@ main(int argc, char* argv[]) { admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, admire::adhoc_storage::resources{adhoc_nodes}, 100, false}; - ADM_return_t ret = ADM_SUCCESS; try { const auto job = admire::register_job( server, admire::job::resources{job_nodes}, reqs); const auto adhoc_storage = admire::register_adhoc_storage( - server, job, user_id, adhoc_storage_ctx); + server, user_id, adhoc_storage_ctx); + + fmt::print(stdout, + "ADM_register_adhoc_storage() remote procedure completed " + "successfully\n"); } catch(const std::exception& e) { fmt::print(stderr, "FATAL: ADM_register_adhoc_storage() failed: {}\n", e.what()); exit(EXIT_FAILURE); } - - if(ret != ADM_SUCCESS) { - fmt::print( - stdout, - "ADM_register_adhoc_storage() remote procedure not completed " - "successfully\n"); - exit(EXIT_FAILURE); - } - - fmt::print(stdout, - "ADM_register_adhoc_storage() remote procedure completed " - "successfully\n"); } diff --git a/src/common/net/proto/rpc_types.h b/src/common/net/proto/rpc_types.h index d4826fe8..c11bc37f 100644 --- a/src/common/net/proto/rpc_types.h +++ b/src/common/net/proto/rpc_types.h @@ -329,7 +329,6 @@ MERCURY_GEN_PROC( /// ADM_register_adhoc_storage MERCURY_GEN_PROC( ADM_register_adhoc_storage_in_t, - ((ADM_job_t) (job)) ((hg_const_string_t) (id)) ((ADM_adhoc_context_t)(ctx)) ); diff --git a/src/lib/admire.cpp b/src/lib/admire.cpp index e94ad7f7..a7991fab 100644 --- a/src/lib/admire.cpp +++ b/src/lib/admire.cpp @@ -234,11 +234,10 @@ remove_job(const server& srv, const job& job) { } admire::adhoc_storage -register_adhoc_storage(const server& srv, const job& job, - const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& user_id, const adhoc_storage::ctx& ctx) { - const auto rv = detail::register_adhoc_storage(srv, job, user_id, ctx); + const auto rv = detail::register_adhoc_storage(srv, user_id, ctx); if(!rv) { throw std::runtime_error( diff --git a/src/lib/admire.h b/src/lib/admire.h index 355da02e..aa52deff 100644 --- a/src/lib/admire.h +++ b/src/lib/admire.h @@ -89,7 +89,6 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job); * Register an adhoc storage system. * * @param[in] server The server to which the request is directed - * @param[in] job An ADM_JOB identifying the originating job. * @param[in] user_id The desired user id for the adhoc storage system. * @param[in] ctx The EXECUTION_CONTEXT for the adhoc storage system. * @param[out] adhoc_storage An ADM_STORAGE referring to the newly-created @@ -98,8 +97,8 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job); * successfully. */ ADM_return_t -ADM_register_adhoc_storage(ADM_server_t server, ADM_job_t job, - const char* user_id, ADM_adhoc_context_t ctx, +ADM_register_adhoc_storage(ADM_server_t server, const char* user_id, + ADM_adhoc_context_t ctx, ADM_storage_t* adhoc_storage); /** diff --git a/src/lib/admire.hpp b/src/lib/admire.hpp index d44275cb..d62a9850 100644 --- a/src/lib/admire.hpp +++ b/src/lib/admire.hpp @@ -59,8 +59,7 @@ ADM_return_t remove_job(const server& srv, const job& job); admire::adhoc_storage -register_adhoc_storage(const server& srv, const job& job, - const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& user_id, const adhoc_storage::ctx& ctx); ADM_return_t diff --git a/src/lib/c_wrapper.cpp b/src/lib/c_wrapper.cpp index cf375e0c..6ac4a26d 100644 --- a/src/lib/c_wrapper.cpp +++ b/src/lib/c_wrapper.cpp @@ -81,14 +81,14 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job) { } ADM_return_t -ADM_register_adhoc_storage(ADM_server_t server, ADM_job_t job, - const char* user_id, ADM_adhoc_context_t ctx, +ADM_register_adhoc_storage(ADM_server_t server, const char* user_id, + ADM_adhoc_context_t ctx, ADM_storage_t* adhoc_storage) { const admire::server srv{server}; const auto rv = admire::detail::register_adhoc_storage( - srv, admire::job{job}, user_id, admire::adhoc_storage::ctx{ctx}); + srv, user_id, admire::adhoc_storage::ctx{ctx}); if(!rv) { diff --git a/src/lib/detail/impl.cpp b/src/lib/detail/impl.cpp index 1d7f593c..7e9f7120 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -315,8 +315,7 @@ remove_job(const server& srv, const job& job) { } tl::expected -register_adhoc_storage(const server& srv, const job& job, - const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& user_id, const adhoc_storage::ctx& ctx) { scord::network::rpc_client rpc_client{srv.protocol(), rpc_registration_cb}; @@ -325,16 +324,14 @@ register_adhoc_storage(const server& srv, const job& job, auto endp = rpc_client.lookup(srv.address()); LOGGER_INFO("rpc id: {} name: {} from: {} => " - "body: {{job: {}}}", + "body: {{user_id: {}, adhoc_ctx: {}}}", rpc_id, std::quoted("ADM_"s + __FUNCTION__), - std::quoted(rpc_client.self_address()), job); + std::quoted(rpc_client.self_address()), user_id, ctx); - const auto rpc_job = api::convert(job); const auto rpc_user_id = user_id.c_str(); const auto rpc_ctx = api::convert(ctx); - ADM_register_adhoc_storage_in_t in{rpc_job.get(), rpc_user_id, - rpc_ctx.get()}; + ADM_register_adhoc_storage_in_t in{rpc_user_id, rpc_ctx.get()}; ADM_register_adhoc_storage_out_t out; const auto rpc = endp.call("ADM_register_adhoc_storage", &in, &out); diff --git a/src/lib/detail/impl.hpp b/src/lib/detail/impl.hpp index 2a5eb1b1..8505b168 100644 --- a/src/lib/detail/impl.hpp +++ b/src/lib/detail/impl.hpp @@ -53,7 +53,7 @@ transfer_datasets(const server& srv, const job& job, transfer::mapping mapping); tl::expected -register_adhoc_storage(const server& srv, const job& job, const std::string& id, +register_adhoc_storage(const server& srv, const std::string& id, const adhoc_storage::ctx& ctx); } // namespace admire::detail diff --git a/src/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index d236c32e..3bbeefaf 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -236,15 +236,14 @@ ADM_register_adhoc_storage(hg_handle_t h) { ret = margo_get_input(h, &in); assert(ret == HG_SUCCESS); - const admire::job job(in.job); const std::string id(in.id); const admire::adhoc_storage::ctx ctx(in.ctx); const auto rpc_id = remote_procedure::new_id(); LOGGER_INFO("rpc id: {} name: {} from: {} => " - "body: {{job: {}}}", + "body: {{user_id: {}, adhoc_ctx: {}}}", rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)), - job); + id, ctx); const auto adhoc_storage = adhoc_storage_manager::create( admire::adhoc_storage::type::gekkofs, id, ctx); -- GitLab