1 # Copyright (c) 2017-2020. The SimGrid Team. All rights reserved.
3 # This program is free software you can redistribute it and/or modify it
4 # under the terms of the license (GNU LGPL) which comes with this package.
6 from simgrid import Actor, Engine, Host, this_actor
11 this_actor.info("Sleeper started")
12 this_actor.sleep_for(3)
13 this_actor.info("I'm done. See you!")
17 this_actor.info("Start 1st sleeper")
18 actor = Actor.create("1st sleeper from master", Host.current(), sleeper)
19 this_actor.info("Join the 1st sleeper (timeout 2)")
22 this_actor.info("Start 2nd sleeper")
23 actor = Actor.create("2nd sleeper from master", Host.current(), sleeper)
24 this_actor.info("Join the 2nd sleeper (timeout 4)")
27 this_actor.info("Start 3rd sleeper")
28 actor = Actor.create("3rd sleeper from master", Host.current(), sleeper)
29 this_actor.info("Join the 3rd sleeper (timeout 2)")
32 this_actor.info("Start 4th sleeper")
33 actor = Actor.create("4th sleeper from master", Host.current(), sleeper)
34 this_actor.info("Waiting 4")
35 this_actor.sleep_for(4)
36 this_actor.info("Join the 4th sleeper after its end (timeout 1)")
39 this_actor.info("Goodbye now!")
41 this_actor.sleep_for(1)
43 this_actor.info("Goodbye now!")
46 if __name__ == '__main__':
50 "Usage: actor-join.py platform_file [other parameters]")
52 e.load_platform(sys.argv[1])
54 Actor.create("master", Host.by_name("Tremblay"), master)
58 this_actor.info("Simulation time {}".format(Engine.get_clock()))