X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b8df87e176f27b25534f27d7e240defa32ca35bc..66142ce747d425a7c608aa1b9e8b50f8d8c78779:/examples/python/actor-join/actor-join.py diff --git a/examples/python/actor-join/actor-join.py b/examples/python/actor-join/actor-join.py index f0aba2af6b..0a59caf324 100644 --- a/examples/python/actor-join/actor-join.py +++ b/examples/python/actor-join/actor-join.py @@ -6,43 +6,48 @@ from simgrid import * import sys + def sleeper(): this_actor.info("Sleeper started") this_actor.sleep_for(3) this_actor.info("I'm done. See you!") + def master(): - this_actor.info("Start sleeper") - actor = Actor.create("sleeper from master", Host.current(), sleeper) - this_actor.info("Join the sleeper (timeout 2)") - actor.join(2) + this_actor.info("Start sleeper") + actor = Actor.create("sleeper from master", Host.current(), sleeper) + this_actor.info("Join the sleeper (timeout 2)") + actor.join(2) + + this_actor.info("Start sleeper") + actor = Actor.create("sleeper from master", Host.current(), sleeper) + this_actor.info("Join the sleeper (timeout 4)") + actor.join(4) - this_actor.info("Start sleeper") - actor = Actor.create("sleeper from master", Host.current(), sleeper) - this_actor.info("Join the sleeper (timeout 4)") - actor.join(4) + this_actor.info("Start sleeper") + actor = Actor.create("sleeper from master", Host.current(), sleeper) + this_actor.info("Join the sleeper (timeout 2)") + actor.join(2) - this_actor.info("Start sleeper") - actor = Actor.create("sleeper from master", Host.current(), sleeper) - this_actor.info("Join the sleeper (timeout 2)") - actor.join(2) + this_actor.info("Start sleeper") + actor = Actor.create("sleeper from master", Host.current(), sleeper) + this_actor.info("Waiting 4") + this_actor.sleep_for(4) + this_actor.info("Join the sleeper after its end (timeout 1)") + actor.join(1) - this_actor.info("Start sleeper") - actor = Actor.create("sleeper from master", Host.current(), sleeper) - this_actor.info("Waiting 4") - this_actor.sleep_for(4) - this_actor.info("Join the sleeper after its end (timeout 1)") - actor.join(1) + this_actor.info("Goodbye now!") - this_actor.info("Goodbye now!") + this_actor.sleep_for(1) - this_actor.sleep_for(1) + this_actor.info("Goodbye now!") - this_actor.info("Goodbye now!") if __name__ == '__main__': e = Engine(sys.argv) - if len(sys.argv) < 2: raise AssertionError("Usage: actor-join.py platform_file [other parameters]") + if len(sys.argv) < 2: + raise AssertionError( + "Usage: actor-join.py platform_file [other parameters]") e.load_platform(sys.argv[1])