From c405aa8f8e373531b1f3cb8f7e2e4dfe59e188bb Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 2 Mar 2022 22:25:33 +0100 Subject: [PATCH] Chaos-monkey: use the new Engine::on_simulation_start signal The plaform_created one that we used earlier is only reliable with XML platforms. --- src/plugins/chaos_monkey.cpp | 2 +- .../s4u/monkey-masterworkers/monkey-masterworkers.cpp | 7 +------ tools/simgrid-monkey | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/plugins/chaos_monkey.cpp b/src/plugins/chaos_monkey.cpp index 32c9ba7edd..da2ee32e8a 100644 --- a/src/plugins/chaos_monkey.cpp +++ b/src/plugins/chaos_monkey.cpp @@ -29,7 +29,7 @@ static void sg_chaos_monkey_plugin_init() XBT_INFO("Initializing the chaos monkey"); // delay the initialization until after the parameter are parsed - sg4::Engine::on_platform_created_cb([]() { + sg4::Engine::on_simulation_start_cb([]() { auto engine = sg4::Engine::get_instance(); auto hosts = engine->get_all_hosts(); auto links = engine->get_all_links(); diff --git a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp index d38b58d3af..8e14acd194 100644 --- a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp +++ b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp @@ -78,11 +78,7 @@ static void worker(int id) auto payload = mailbox->get_unique(10); xbt_assert(payload != nullptr, "mailbox->get() failed"); double comp_size = *payload; - if (comp_size < 0) { /* - Exit when -1.0 is received */ - XBT_INFO("I'm done. See you!"); - break; - } - /* - Otherwise, process the task */ + XBT_INFO("Start execution..."); sg4::this_actor::execute(comp_size); XBT_INFO("Execution complete."); @@ -120,7 +116,6 @@ int main(int argc, char* argv[]) } } rootzone->seal(); - sg4::Engine::on_platform_created(); // FIXME this should not be necessary sg4::Actor::create("master", main, master)->set_auto_restart(true); int id = 0; diff --git a/tools/simgrid-monkey b/tools/simgrid-monkey index d5cd721a21..d2f627344d 100755 --- a/tools/simgrid-monkey +++ b/tools/simgrid-monkey @@ -93,7 +93,7 @@ def do_run(cmd, extra_params, test_todo): msg = f"ERROR (retcode: {run.returncode}). Output:\n" msg += out print(msg) - os.exit(1) + sys.exit(1) for line in out.split("\n"): if re.match("==.* in use at exit: ", line) and not re.match("==.* in use at exit: 0 bytes in 0 blocks", line): m = re.match("==.* in use at exit: (.*)", line) -- 2.20.1