1 # Copyright (c) 2019-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 Second failing example for bug #9 on Framagit (Python bindings crashing)
9 An intricate recursion is used to make the crash happen.
13 from simgrid import Engine, this_actor
15 def do_sleep1(i, dur):
17 this_actor.info("1-Iter {:d}".format(i))
19 this_actor.sleep_for(dur)
20 this_actor.info("1-Mid ({:d})".format(i))
21 do_sleep3(int(i / 2), dur)
22 this_actor.info("1-Done ({:d})".format(i))
24 def do_sleep3(i, dur):
26 this_actor.info("3-Iter {:d}".format(i))
28 this_actor.sleep_for(dur)
29 this_actor.info("3-Mid ({:d})".format(i))
30 do_sleep5(int(i / 2), dur)
31 this_actor.info("3-Done ({:d})".format(i))
33 def do_sleep5(i, dur):
35 this_actor.info("5-Iter {:d}".format(i))
37 this_actor.sleep_for(dur)
38 this_actor.info("5-Mid ({:d})".format(i))
39 do_sleep1(int(i / 2), dur)
40 this_actor.info("5-Done ({:d})".format(i))
51 if __name__ == '__main__':
54 e.load_platform(sys.argv[1]) # Load the platform description
56 # Register the classes representing the actors
57 e.register_actor("sleeper1", sleeper1)
58 e.register_actor("sleeper3", sleeper3)
59 e.register_actor("sleeper5", sleeper5)
61 e.load_deployment(sys.argv[2])
64 this_actor.info("Finalize!")