Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use same "main" syntax for this example as for others
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 18 Dec 2019 10:12:59 +0000 (11:12 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 18 Dec 2019 10:13:51 +0000 (11:13 +0100)
(still not able to test python ...)

examples/python/exec-basic/exec-basic.py

index 60e0bf6..f2e1420 100644 (file)
@@ -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()