Commit a066d036 authored by Matthieu Dorier's avatar Matthieu Dorier

shutdown now using the margo-integrated shutdown functionality

parent b3a16897
......@@ -23,7 +23,6 @@ struct bake_client
margo_instance_id mid;
hg_id_t bake_probe_id;
hg_id_t bake_shutdown_id;
hg_id_t bake_create_id;
hg_id_t bake_eager_write_id;
hg_id_t bake_eager_read_id;
......@@ -56,7 +55,6 @@ static int bake_client_register(bake_client_t client, margo_instance_id mid)
if(flag == HG_TRUE) { /* RPCs already registered */
margo_registered_name(mid, "bake_probe_rpc", &client->bake_probe_id, &flag);
margo_registered_name(mid, "bake_shutdown_rpc", &client->bake_shutdown_id, &flag);
margo_registered_name(mid, "bake_create_rpc", &client->bake_create_id, &flag);
margo_registered_name(mid, "bake_write_rpc", &client->bake_write_id, &flag);
margo_registered_name(mid, "bake_eager_write_rpc", &client->bake_eager_write_id, &flag);
......@@ -72,9 +70,6 @@ static int bake_client_register(bake_client_t client, margo_instance_id mid)
client->bake_probe_id =
MARGO_REGISTER(mid, "bake_probe_rpc",
bake_probe_in_t, bake_probe_out_t, NULL);
client->bake_shutdown_id =
MARGO_REGISTER(mid, "bake_shutdown_rpc",
void, void, NULL);
client->bake_create_id =
MARGO_REGISTER(mid, "bake_create_rpc",
bake_create_in_t, bake_create_out_t, NULL);
......@@ -245,24 +240,7 @@ int bake_provider_handle_release(bake_provider_handle_t handle)
int bake_shutdown_service(bake_client_t client, hg_addr_t addr)
{
hg_return_t hret;
hg_handle_t handle;
hret = margo_create(client->mid, addr,
client->bake_shutdown_id, &handle);
if(hret != HG_SUCCESS)
return(-1);
hret = margo_forward(handle, NULL);
if(hret != HG_SUCCESS)
{
margo_destroy(handle);
return(-1);
}
margo_destroy(handle);
return(0);
return margo_shutdown_remote_instance(client->mid, addr);
}
static int bake_eager_write(
......
......@@ -30,7 +30,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_create_ult)
/* BAKE write */
MERCURY_GEN_PROC(bake_write_in_t,
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((hg_bulk_t)(bulk_handle))\
......@@ -44,7 +43,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_write_ult)
/* BAKE eager write */
typedef struct
{
/* bake_target_id_t bti; */
bake_region_id_t rid;
uint64_t region_offset;
uint32_t size;
......@@ -57,7 +55,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_eager_write_ult)
/* BAKE persist */
MERCURY_GEN_PROC(bake_persist_in_t,
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_persist_out_t,
((int32_t)(ret)))
......@@ -79,7 +76,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_create_write_persist_ult)
/* BAKE get size */
MERCURY_GEN_PROC(bake_get_size_in_t,
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid)))
MERCURY_GEN_PROC(bake_get_size_out_t,
((int32_t)(ret))\
......@@ -88,7 +84,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_get_size_ult)
/* BAKE read */
MERCURY_GEN_PROC(bake_read_in_t,
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((hg_bulk_t)(bulk_handle))\
......@@ -101,7 +96,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_read_ult)
/* BAKE eager read */
MERCURY_GEN_PROC(bake_eager_read_in_t,
/* ((bake_target_id_t)(bti))\ */
((bake_region_id_t)(rid))\
((uint64_t)(region_offset))\
((uint32_t)(size)))
......@@ -117,9 +111,6 @@ DECLARE_MARGO_RPC_HANDLER(bake_eager_read_ult)
/* BAKE probe */
MERCURY_GEN_PROC(bake_probe_in_t,
((uint64_t)(max_targets)))
//MERCURY_GEN_PROC(bake_probe_out_t,
// ((int32_t)(ret))\
// ((bake_target_id_t)(bti)))
typedef struct
{
int32_t ret;
......@@ -161,7 +152,6 @@ static inline hg_return_t hg_proc_bake_eager_write_in_t(hg_proc_t proc, void *v_
bake_eager_write_in_t *in = v_out_p;
void *buf = NULL;
/* hg_proc_bake_target_id_t(proc, &in->bti); */
hg_proc_bake_region_id_t(proc, &in->rid);
hg_proc_uint64_t(proc, &in->region_offset);
hg_proc_uint32_t(proc, &in->size);
......
......@@ -102,6 +102,8 @@ int main(int argc, char **argv)
return(-1);
}
margo_enable_remote_shutdown(mid);
if(opts.host_file)
{
/* write the server address to file if requested */
......
......@@ -101,10 +101,6 @@ int bake_provider_register(
/* register RPCs */
hg_id_t rpc_id;
rpc_id = MARGO_REGISTER_MPLEX(mid, "bake_shutdown_rpc",
void, void, bake_shutdown_ult, mplex_id, abt_pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL);
void* test = margo_registered_data_mplex(mid, rpc_id, mplex_id);
rpc_id = MARGO_REGISTER_MPLEX(mid, "bake_create_rpc",
bake_create_in_t, bake_create_out_t,
bake_create_ult, mplex_id, abt_pool);
......@@ -254,30 +250,7 @@ int bake_provider_list_storage_targets(
return 0;
}
/* service a remote RPC that instructs the BAKE server to shut down */
static void bake_shutdown_ult(hg_handle_t handle)
{
hg_return_t hret;
margo_instance_id mid;
mid = margo_hg_handle_get_instance(handle);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(handle);
/* NOTE: we assume that the server daemon is using
* margo_wait_for_finalize() to suspend until this RPC executes, so
* there is no need to send any extra signal to notify it.
*/
margo_finalize(mid);
return;
}
DEFINE_MARGO_RPC_HANDLER(bake_shutdown_ult)
/* service a remote RPC that creates a BAKE region */
/* service a remote RPC that creates a BAKE region */
static void bake_create_ult(hg_handle_t handle)
{
bake_create_out_t out;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment