X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4d648ebbbe5705878080b9cbf1ca61497323c592..84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6:/examples/python/exec-basic/exec-basic.py diff --git a/examples/python/exec-basic/exec-basic.py b/examples/python/exec-basic/exec-basic.py index 7d088474f8..579c3f41fa 100644 --- a/examples/python/exec-basic/exec-basic.py +++ b/examples/python/exec-basic/exec-basic.py @@ -1,10 +1,10 @@ -# Copyright (c) 2018-2019. The SimGrid Team. All rights reserved. +# Copyright (c) 2018-2020. The SimGrid Team. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. +from simgrid import Actor, Engine, Host, this_actor import sys -from simgrid import * def executor(): @@ -30,13 +30,11 @@ def privileged(): # quite quickly. -i = 0 -if "--" in sys.argv: - i = sys.argv.index("--") -e = Engine(sys.argv[0:i]) -e.load_platform(sys.argv[i + 1]) +if __name__ == '__main__': + e = Engine(sys.argv) + e.load_platform(sys.argv[1]) -Actor.create("executor", Host.by_name("Tremblay"), executor) -Actor.create("privileged", Host.by_name("Tremblay"), privileged) + Actor.create("executor", Host.by_name("Tremblay"), executor) + Actor.create("privileged", Host.by_name("Tremblay"), privileged) -e.run() + e.run()