Verified Commit 28fe772e authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Update logging for register_adhoc_storage to new style

parent 719eeed4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -306,6 +306,7 @@ MERCURY_GEN_PROC(

MERCURY_GEN_PROC(
    ADM_register_adhoc_storage_out_t,
        ((hg_uint64_t) (op_id))
        ((int32_t) (retval))
        ((uint64_t)(server_id))
);
+15 −4
Original line number Diff line number Diff line
@@ -314,9 +314,13 @@ register_adhoc_storage(const server& srv, const job& job,

    scord::network::rpc_client rpc_client{srv.protocol(), rpc_registration_cb};

    const auto rpc_id = ::api::remote_procedure::new_id();
    auto endp = rpc_client.lookup(srv.address());

    LOGGER_INFO("RPC (ADM_{}) => {{job: {}}}", __FUNCTION__, job);
    LOGGER_INFO("rpc id: name: {} from: {} => "
                "body: {{job: {}}}",
                rpc_id, std::quoted("ADM_"s + __FUNCTION__),
                std::quoted(rpc_client.self_address()), job);

    const auto rpc_job = api::convert(job);
    const auto rpc_user_id = user_id.c_str();
@@ -329,14 +333,21 @@ register_adhoc_storage(const server& srv, const job& job,
    const auto rpc = endp.call("ADM_register_adhoc_storage", &in, &out);

    if(out.retval < 0) {
        LOGGER_ERROR("RPC (ADM_{}) <= {}", __FUNCTION__, out.retval);
        return tl::make_unexpected(static_cast<admire::error_code>(out.retval));
        const auto retval = static_cast<admire::error_code>(out.retval);
        LOGGER_ERROR("rpc id: {} name: {} from: {} <= "
                     "body: {{retval: {}}} [op_id: {}]",
                     rpc_id, std::quoted("ADM_"s + __FUNCTION__), retval,
                     out.op_id);
        return tl::make_unexpected(retval);
    }

    const auto rpc_adhoc_storage =
            admire::adhoc_storage{admire::storage::type::gekkofs, user_id, ctx};

    LOGGER_INFO("RPC (ADM_{}) <= {{retval: {}}}", __FUNCTION__, ADM_SUCCESS);
    LOGGER_INFO("rpc id: {} name: {} from: {} <= "
                "body: {{retval: {}}} [op_id: {}]",
                rpc_id, std::quoted("ADM_"s + __FUNCTION__), ADM_SUCCESS,
                out.op_id);

    return rpc_adhoc_storage;
}
+9 −3
Original line number Diff line number Diff line
@@ -227,18 +227,24 @@ ADM_register_adhoc_storage(hg_handle_t h) {
    const admire::adhoc_storage::ctx ctx(in.ctx);

    const auto rpc_id = remote_procedure::new_id();
    LOGGER_INFO("RPC ID {} ({}) <= {{job: {{{}}}}}", rpc_id, __FUNCTION__, job);
    LOGGER_INFO("rpc id: {} name: {} from: {} => "
                "body: {{job: {}}}",
                rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)),
                job);

    const auto adhoc_storage = admire::adhoc_storage(
            admire::adhoc_storage::type::gekkofs, id, ctx);

    admire::error_code rv = ADM_SUCCESS;

    out.op_id = rpc_id;
    out.retval = rv;
    out.server_id = adhoc_storage.id();

    LOGGER_INFO("RPC ID {} ({}) => {{retval: {}, server_id: {}}}", rpc_id,
                out.server_id, __FUNCTION__, rv);
    LOGGER_INFO("rpc id: {} name: {} to: {} => "
                "body: {{retval: {}, server_id: {}}}",
                rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)),
                rv, out.server_id);

    ret = margo_respond(h, &out);
    assert(ret == HG_SUCCESS);