Skip to content

Commit 97dcf50

Browse files
committed
margo_state_dump is only currently available in margo@master, hence we cannot compile with the latest margo release. To fix, use of margo_state_dump requires Chimbuko to be built with the --enable-margo-state-dump option.
1 parent ccdcbd6 commit 97dcf50

6 files changed

Lines changed: 45 additions & 9 deletions

File tree

app/provdb_admin.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void client_stop_rpc(const tl::request& req) {
108108

109109
margo_instance_id margo_id;
110110

111+
#ifdef ENABLE_MARGO_STATE_DUMP
111112
void margo_dump(const std::string &stub){
112113
std::string fn = stub + "." + getDateTimeFileExt();
113114
progressStream << "ProvDB Admin: margo dump to " << fn << std::endl;
@@ -118,8 +119,7 @@ void margo_dump_rpc(const tl::request& req) {
118119
const static std::string stub("margo_dump");
119120
margo_dump(stub);
120121
}
121-
122-
122+
#endif
123123

124124

125125
struct ProvdbArgs{
@@ -229,9 +229,10 @@ int main(int argc, char** argv) {
229229
engine.define("committer_hello",committer_hello).disable_response();
230230
engine.define("committer_goodbye",committer_goodbye).disable_response();
231231
engine.define("stop_server",client_stop_rpc).disable_response();
232-
engine.define("margo_dump", margo_dump_rpc).disable_response();
233232
engine.define("connection_status", connection_status);
234-
233+
#ifdef ENABLE_MARGO_STATE_DUMP
234+
engine.define("margo_dump", margo_dump_rpc).disable_response();
235+
#endif
235236

236237
std::string addr = (std::string)engine.self(); //ip and port of admin
237238

@@ -325,7 +326,9 @@ int main(int argc, char** argv) {
325326
( !committer_has_connected || (committer_has_connected && !committer_connected) )
326327
){
327328
progressStream << "ProvDB Admin: detected all clients disconnected, shutting down" << std::endl;
329+
#ifdef ENABLE_MARGO_STATE_DUMP
328330
margo_dump("margo_dump_all_client_disconnected");
331+
#endif
329332
break;
330333
}
331334
}
@@ -338,11 +341,15 @@ int main(int argc, char** argv) {
338341
}
339342

340343
progressStream << "ProvDB Admin: ending admin scope" << std::endl;
344+
#ifdef ENABLE_MARGO_STATE_DUMP
341345
margo_dump("margo_dump_end_admin_scope");
346+
#endif
342347
}//admin scope
343348

344349
progressStream << "ProvDB Admin: ending provider scope" << std::endl;
350+
#ifdef ENABLE_MARGO_STATE_DUMP
345351
margo_dump("margo_dump_end_provide_scope");
352+
#endif
346353
}//provider scope
347354

348355
progressStream << "ProvDB Admin: shutting down server engine" << std::endl;

app/provdb_dump_state.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using namespace chimbuko;
44

55
int main(int argc, char** argv){
66
#ifdef ENABLE_PROVDB
7+
# ifdef ENABLE_MARGO_STATE_DUMP
78
if(argc != 2){
89
std::cout << "Usage: provdb_dump_state <server address e.g. ofi+tcp;ofi_rxm://172.17.0.4:5000>" << std::endl;
910
return 1;
@@ -14,6 +15,10 @@ int main(int argc, char** argv){
1415
ad.disconnect();
1516

1617
return 0;
18+
# else
19+
std::cout << "Margo dump configuration option is disabled" << std::endl;
20+
return 1;
21+
# endif
1722
#else
1823
std::cout << "ProvDB not in use" << std::endl;
1924
return 1;

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ fi
142142
#AC_ARG_WITH([perf-metric], AS_HELP_STRING([--with-perf-metric], [Specify use of performance metrics]),[AC_DEFINE([_PERF_METRIC],[1],[Use performance metrics])],[])
143143
AC_ARG_WITH([perf-metric], AS_HELP_STRING([--with-perf-metric], [Specify use of performance metrics]),[PS_FLAGS+=" -D_PERF_METRIC"],[])
144144

145+
#Enable ProvdDB margo state dump (currently requires master branch of margo)
146+
AC_ARG_ENABLE([margo-state-dump],
147+
[AS_HELP_STRING([--enable-margo-state-dump], [Enable ProvdDB margo state dump (currently requires master branch of margo)] )],
148+
[AC_DEFINE([ENABLE_MARGO_STATE_DUMP],[1],[Use margo state dump])],
149+
[:]
150+
)
145151

146152
#Check for boost
147153
AC_ARG_WITH([boost], AS_HELP_STRING([--with-boost], [Specify Boost install directory]),[],[])

include/chimbuko/ad/ADProvenanceDBclient.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ namespace chimbuko{
9191
thallium::remote_procedure *m_client_hello; /**< RPC to register client with provDB */
9292
thallium::remote_procedure *m_client_goodbye; /**< RPC to deregister client with provDB */
9393
thallium::remote_procedure *m_stop_server; /** RPC to shutdown server*/
94+
#ifdef ENABLE_MARGO_STATE_DUMP
9495
thallium::remote_procedure *m_margo_dump; /** RPC to request the server dump its state*/
95-
96+
#endif
9697
bool m_perform_handshake; /**< Optionally disable the client->server registration */
9798

9899
PerfStats *m_stats; /**< Performance data gathering*/
@@ -106,7 +107,11 @@ namespace chimbuko{
106107
void sendMultipleDataAsync(const std::vector<std::string> &entries, const ProvenanceDataType type, OutstandingRequest *req = nullptr) const;
107108

108109
public:
109-
ADProvenanceDBclient(int rank): m_is_connected(false), m_rank(rank), m_client_hello(nullptr), m_client_goodbye(nullptr), m_stats(nullptr), m_stop_server(nullptr), m_margo_dump(nullptr), m_perform_handshake(true){}
110+
/**
111+
* @brief Constructor
112+
* @param The rank of the current process
113+
*/
114+
ADProvenanceDBclient(int rank);
110115

111116
~ADProvenanceDBclient();
112117

@@ -242,10 +247,12 @@ namespace chimbuko{
242247
*/
243248
void stopServer() const;
244249

250+
#ifdef ENABLE_MARGO_STATE_DUMP
245251
/**
246252
* @brief Issue an RPC request telling the server to dump its state
247253
*/
248254
void serverDumpState() const;
255+
#endif
249256

250257
};
251258

src/ad/ADProvenanceDBclient.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ static void delete_rpc(thallium::remote_procedure* &rpc){
7272
delete rpc; rpc = nullptr;
7373
}
7474

75+
ADProvenanceDBclient::ADProvenanceDBclient(int rank): m_is_connected(false), m_rank(rank), m_client_hello(nullptr), m_client_goodbye(nullptr), m_stats(nullptr), m_stop_server(nullptr), m_perform_handshake(true)
76+
#ifdef ENABLE_MARGO_STATE_DUMP
77+
, m_margo_dump(nullptr)
78+
#endif
79+
{}
80+
7581

7682
void ADProvenanceDBclient::disconnect(){
7783
if(m_is_connected){
@@ -90,8 +96,9 @@ void ADProvenanceDBclient::disconnect(){
9096
delete_rpc(m_client_goodbye);
9197
}
9298
delete_rpc(m_stop_server);
99+
#ifdef ENABLE_MARGO_STATE_DUMP
93100
delete_rpc(m_margo_dump);
94-
101+
#endif
95102
m_is_connected = false;
96103
verboseStream << "ADProvenanceDBclient disconnected" << std::endl;
97104
}
@@ -153,7 +160,9 @@ void ADProvenanceDBclient::connect(const std::string &addr, const int nshards){
153160
}
154161

155162
m_stop_server = new thallium::remote_procedure(eng.define("stop_server").disable_response());
163+
#ifdef ENABLE_MARGO_STATE_DUMP
156164
m_margo_dump = new thallium::remote_procedure(eng.define("margo_dump").disable_response());
165+
#endif
157166

158167
m_is_connected = true;
159168
verboseStream << "DB client rank " << m_rank << " connected successfully to database" << std::endl;
@@ -355,11 +364,12 @@ void ADProvenanceDBclient::stopServer() const{
355364
m_stop_server->on(m_server)();
356365
}
357366

367+
#ifdef ENABLE_MARGO_STATE_DUMP
358368
void ADProvenanceDBclient::serverDumpState() const{
359369
verboseStream << "ADProvenanceDBclient requesting server dump its state" << std::endl;
360370
m_margo_dump->on(m_server)();
361371
}
362-
372+
#endif
363373

364374
#endif
365375

test/mainProvDBclient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ bool fileExistsMatchingRegex(const std::string &dir, const std::regex &regex){
332332
return false;
333333
}
334334

335+
#ifdef ENABLE_MARGO_STATE_DUMP
335336
TEST(ADProvenanceDBclientTest, TestStateDump){
336337
if(rank == 0){
337338
std::regex fn(R"(margo_dump\.)");
@@ -360,7 +361,7 @@ TEST(ADProvenanceDBclientTest, TestStateDump){
360361
EXPECT_EQ(fail, false);
361362
}
362363
}
363-
364+
#endif
364365

365366

366367
int main(int argc, char** argv)

0 commit comments

Comments
 (0)