Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Chaos-monkey: use the new Engine::on_simulation_start signal
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 2 Mar 2022 21:25:33 +0000 (22:25 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 2 Mar 2022 23:57:21 +0000 (00:57 +0100)
The plaform_created one that we used earlier is only reliable with XML
platforms.

src/plugins/chaos_monkey.cpp
teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp
tools/simgrid-monkey

index 32c9ba7..da2ee32 100644 (file)
@@ -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();
index d38b58d..8e14acd 100644 (file)
@@ -78,11 +78,7 @@ static void worker(int id)
       auto payload = mailbox->get_unique<double>(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;
index d5cd721..d2f6273 100755 (executable)
@@ -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)