Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bake
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
bake
Commits
6eeade93
Commit
6eeade93
authored
Apr 18, 2016
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shutdown utility
parent
beeb18fc
Pipeline
#153
skipped
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
7 deletions
+119
-7
src/Makefile.subdir
src/Makefile.subdir
+1
-1
src/bake-bulk-server.c
src/bake-bulk-server.c
+4
-6
src/bb-shutdown.c
src/bb-shutdown.c
+114
-0
No files found.
src/Makefile.subdir
View file @
6eeade93
src_libbake_bulk_a_SOURCES
+=
\
src/bake-bulk.c
bin_PROGRAMS
+=
src/bake-bulk-server
bin_PROGRAMS
+=
src/bake-bulk-server
src/bb-shutdown
src_bake_bulk_server_SOURCES
=
\
src/bake-bulk-server.c
\
...
...
src/bake-bulk-server.c
View file @
6eeade93
...
...
@@ -11,6 +11,8 @@
#include <abt-snoozer.h>
#include <margo.h>
#include "bake-bulk-rpc.h"
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
;
...
...
@@ -83,13 +85,9 @@ int main(int argc, char **argv)
mid
=
margo_init
(
handler_pool
,
handler_pool
,
hg_context
,
hg_class
);
assert
(
mid
);
#if 0
/* register RPC */
MERCURY_REGISTER(hg_class, "my_rpc", my_rpc_in_t, my_rpc_out_t,
my_rpc_ult_handler);
MERCURY_REGISTER(hg_class, "my_shutdown_rpc", void, void,
my_rpc_shutdown_ult_handler);
#endif
MERCURY_REGISTER
(
hg_class
,
"bake_bulk_shutdown_rpc"
,
void
,
void
,
bake_bulk_shutdown_ult_handler
);
/* NOTE: at this point this server ULT has two options. It can wait on
* whatever mechanism it wants to (however long the daemon should run and
...
...
src/bb-shutdown.c
0 → 100644
View file @
6eeade93
/*
* (C) 2015 The University of Chicago
*
* See COPYRIGHT in top-level directory.
*/
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <abt.h>
#include <abt-snoozer.h>
#include <margo.h>
#include "bake-bulk-rpc.h"
/* client program that will shut down a BAKE bulk server. */
static
hg_id_t
bake_bulk_shutdown_id
;
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
;
ABT_xstream
xstream
;
ABT_pool
pool
;
margo_instance_id
mid
;
hg_context_t
*
hg_context
;
hg_class_t
*
hg_class
;
hg_addr_t
svr_addr
=
HG_ADDR_NULL
;
hg_handle_t
handle
;
/* boilerplate HG initialization steps */
/***************************************/
/* TODO: fix addr */
hg_class
=
HG_Init
(
"tcp://localhost:1234"
,
HG_FALSE
);
if
(
!
hg_class
)
{
fprintf
(
stderr
,
"Error: HG_Init()
\n
"
);
return
(
-
1
);
}
hg_context
=
HG_Context_create
(
hg_class
);
if
(
!
hg_context
)
{
fprintf
(
stderr
,
"Error: HG_Context_create()
\n
"
);
HG_Finalize
(
hg_class
);
return
(
-
1
);
}
/* set up argobots */
/***************************************/
ret
=
ABT_init
(
argc
,
argv
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: ABT_init()
\n
"
);
return
(
-
1
);
}
/* set primary ES to idle without polling */
ret
=
ABT_snoozer_xstream_self_set
();
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: ABT_snoozer_xstream_self_set()
\n
"
);
return
(
-
1
);
}
/* retrieve current pool to use for ULT creation */
ret
=
ABT_xstream_self
(
&
xstream
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: ABT_xstream_self()
\n
"
);
return
(
-
1
);
}
ret
=
ABT_xstream_get_main_pools
(
xstream
,
1
,
&
pool
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"Error: ABT_xstream_get_main_pools()
\n
"
);
return
(
-
1
);
}
/* actually start margo */
/* provide argobots pools for driving communication progress and
* executing rpc handlers as well as class and context for Mercury
* communication. The rpc handler pool is null in this example program
* because this is a pure client that will not be servicing rpc requests.
*/
/***************************************/
mid
=
margo_init
(
pool
,
ABT_POOL_NULL
,
hg_context
,
hg_class
);
/* register RPC */
bake_bulk_shutdown_id
=
MERCURY_REGISTER
(
hg_class
,
"bake_bulk_shutdown_rpc"
,
void
,
void
,
NULL
);
/* send one rpc to server to shut it down */
/* find addr for server */
/* TODO: fix addr */
ret
=
margo_addr_lookup
(
mid
,
hg_context
,
"tcp://localhost:1234"
,
&
svr_addr
);
assert
(
ret
==
0
);
/* create handle */
ret
=
HG_Create
(
hg_context
,
svr_addr
,
bake_bulk_shutdown_id
,
&
handle
);
assert
(
ret
==
0
);
margo_forward
(
mid
,
handle
,
NULL
);
/* shut down everything */
margo_finalize
(
mid
);
ABT_finalize
();
HG_Context_destroy
(
hg_context
);
HG_Finalize
(
hg_class
);
return
(
0
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment