Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 13 Jan 2019 10:01:06 +0000 (11:01 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 14 Jan 2019 20:05:18 +0000 (21:05 +0100)
examples/python/actor-kill/actor-kill.py
src/bindings/python/simgrid_python.cpp

index a7b66f7..2b53ced 100644 (file)
@@ -7,7 +7,7 @@ from simgrid import *
 import sys
 
 
 import sys
 
 
-def victimA_fun():
+def victrim_a_fun():
     this_actor.on_exit(lambda: this_actor.info("I have been killed!"))
     this_actor.info("Hello!")
     this_actor.info("Suspending myself")
     this_actor.on_exit(lambda: this_actor.info("I have been killed!"))
     this_actor.info("Hello!")
     this_actor.info("Suspending myself")
@@ -19,35 +19,35 @@ def victimA_fun():
     this_actor.info("Bye!")
 
 
     this_actor.info("Bye!")
 
 
-def victimB_fun():
+def victrim_b_fun():
     this_actor.info("Terminate before being killed")
 
 
 def killer():
     this_actor.info("Hello!")  # - First start a victim process
     this_actor.info("Terminate before being killed")
 
 
 def killer():
     this_actor.info("Hello!")  # - First start a victim process
-    victimA = Actor.create("victim A", Host.by_name("Fafard"), victimA_fun)
-    victimB = Actor.create("victim B", Host.by_name("Jupiter"), victimB_fun)
+    victrim_a = Actor.create("victim A", Host.by_name("Fafard"), victrim_a_fun)
+    victrim_b = Actor.create("victim B", Host.by_name("Jupiter"), victrim_b_fun)
     this_actor.sleep_for(10)  # - Wait for 10 seconds
 
     # - Resume it from its suspended state
     this_actor.info("Resume the victim A")
     this_actor.sleep_for(10)  # - Wait for 10 seconds
 
     # - Resume it from its suspended state
     this_actor.info("Resume the victim A")
-    victimA.resume()
+    victrim_a.resume()
     this_actor.sleep_for(2)
 
     this_actor.info("Kill the victim A")   # - and then kill it
     this_actor.sleep_for(2)
 
     this_actor.info("Kill the victim A")   # - and then kill it
-    Actor.by_pid(victimA.pid).kill()       # You can retrieve an actor from its PID (and then kill it)
+    Actor.by_pid(victrim_a.pid).kill()       # You can retrieve an actor from its PID (and then kill it)
 
     this_actor.sleep_for(1)
 
     # that's a no-op, there is no zombies in SimGrid
 
     this_actor.sleep_for(1)
 
     # that's a no-op, there is no zombies in SimGrid
-    this_actor.info("Kill victimB, even if it's already dead")
-    victimB.kill()
+    this_actor.info("Kill victrim_b, even if it's already dead")
+    victrim_b.kill()
 
     this_actor.sleep_for(1)
 
     this_actor.info("Start a new actor, and kill it right away")
 
     this_actor.sleep_for(1)
 
     this_actor.info("Start a new actor, and kill it right away")
-    victimC = Actor.create("victim C", Host.by_name("Jupiter"), victimA_fun)
-    victimC.kill()
+    victrim_c = Actor.create("victim C", Host.by_name("Jupiter"), victrim_a_fun)
+    victrim_c.kill()
 
     this_actor.sleep_for(1)
 
 
     this_actor.sleep_for(1)
 
index 211e650..89aff78 100644 (file)
@@ -32,7 +32,9 @@ namespace {
 
 static std::string get_simgrid_version()
 {
 
 static std::string get_simgrid_version()
 {
-  int major, minor, patch;
+  int major;
+  int minor;
+  int patch;
   sg_version_get(&major, &minor, &patch);
   return simgrid::xbt::string_printf("%i.%i.%i", major, minor, patch);
 }
   sg_version_get(&major, &minor, &patch);
   return simgrid::xbt::string_printf("%i.%i.%i", major, minor, patch);
 }
@@ -77,7 +79,7 @@ PYBIND11_MODULE(simgrid, m)
          [](py::object fun) {
            ActorPtr act = Actor::self();
            simgrid::s4u::this_actor::on_exit(
          [](py::object fun) {
            ActorPtr act = Actor::self();
            simgrid::s4u::this_actor::on_exit(
-               [act, fun](int ignored, void* data) {
+               [act, fun](int /*ignored*/, void* /*data*/) {
                  try {
                    fun();
                  } catch (py::error_already_set& e) {
                  try {
                    fun();
                  } catch (py::error_already_set& e) {