1 # Copyright (c) 2017-2023. 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.
7 Usage: actor-join.py platform_file [other parameters]
11 from simgrid import Actor, Engine, Host, this_actor
15 this_actor.info("Sleeper started")
16 this_actor.sleep_for(3)
17 this_actor.info("I'm done. See you!")
21 this_actor.info("Start 1st sleeper")
22 actor = Actor.create("1st sleeper from master", Host.current(), sleeper)
23 this_actor.info("Join the 1st sleeper (timeout 2)")
26 this_actor.info("Start 2nd sleeper")
27 actor = Actor.create("2nd sleeper from master", Host.current(), sleeper)
28 this_actor.info("Join the 2nd sleeper (timeout 4)")
31 this_actor.info("Start 3rd sleeper")
32 actor = Actor.create("3rd sleeper from master", Host.current(), sleeper)
33 this_actor.info("Join the 3rd sleeper (timeout 2)")
36 this_actor.info("Start 4th sleeper")
37 actor = Actor.create("4th sleeper from master", Host.current(), sleeper)
38 this_actor.info("Waiting 4")
39 this_actor.sleep_for(4)
40 this_actor.info("Join the 4th sleeper after its end (timeout 1)")
43 this_actor.info("Goodbye now!")
45 this_actor.sleep_for(1)
47 this_actor.info("Goodbye now!")
50 if __name__ == '__main__':
54 "Usage: actor-join.py platform_file [other parameters]")
56 e.load_platform(sys.argv[1])
58 Actor.create("master", Host.by_name("Tremblay"), master)
62 this_actor.info("Simulation time {}".format(e.clock))