1 # Copyright (c) 2007-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 This Python file acts as the foil to the corresponding XML file, where the
8 action takes place: Actors are started and stopped at predefined time
12 from simgrid import Engine, this_actor
16 """This actor just sleeps until termination"""
19 this_actor.on_exit(lambda killed: this_actor.info("Exiting now (killed)." if killed else "Exiting now (finishing)."))
22 this_actor.info("Hello! I go to sleep.")
23 this_actor.sleep_for(10)
24 this_actor.info("Done sleeping.")
27 if __name__ == '__main__':
31 "Usage: actor-lifetime.py platform_file actor-lifetime_d.xml [other parameters]")
33 e.load_platform(sys.argv[1]) # Load the platform description
34 e.register_actor("sleeper", Sleeper)
35 # Deploy the sleeper actors with explicit start/kill times
36 e.load_deployment(sys.argv[2])