Prechádzať zdrojové kódy

Use execvp for run_local_modelverse

Yentl Van Tendeloo 8 rokov pred
rodič
commit
90450baebf

+ 1 - 1
integration/utils.py

@@ -51,7 +51,7 @@ def execute(scriptname, parameters=[], wait=False):
     if wait:
         return subprocess.call(command, shell=False)
     else:
-        return subprocess.Popen(command, shell=False, stdout=subprocess.PIPE)
+        return subprocess.Popen(command, shell=False)
 
 def child_kill(pid):
     subprocess.call(["pkill", "-P", "%i" % pid])

+ 0 - 10
scripts/run_debug_modelverse.py

@@ -1,10 +0,0 @@
-import subprocess
-import sys
-
-# sys.executable to use the same Python interpreter used to invoke this command
-if len(sys.argv) != 2:
-    sys.stderr.write("Expected different parameters!\n")
-    sys.stderr.write("    %s port\n" % sys.argv[0])
-else:
-    subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"], cwd="kernel/mvk_server")
-    subprocess.call([sys.executable, "run_mvk_server.py", sys.argv[1]], cwd="kernel/mvk_server")

+ 6 - 8
scripts/run_local_modelverse.py

@@ -1,5 +1,6 @@
 import subprocess
 import sys
+import os
 
 # sys.executable to use the same Python interpreter used to invoke this command
 if len(sys.argv) < 2:
@@ -7,12 +8,9 @@ if len(sys.argv) < 2:
 else:
     port = sys.argv[1]
 
-subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"], cwd="hybrid_server")
-subprocess.call([sys.executable, "run_mvk_server.py", port], cwd="hybrid_server")
+os.chdir("hybrid_server")
+subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"])
+os.execv(sys.executable, [sys.executable, "run_mvk_server.py", port])
 
-# Write to /tmp/stdout
-#subprocess.call([sys.executable, "run_mvk_server.py", port], cwd="hybrid_server", stdout=open("/tmp/stdout", "w"))
-
-# Additional ways of calling...
-#subprocess.call([sys.executable, "run_mvk_server.py", port] + ["--kernel=baseline-jit"], cwd="hybrid_server")
-#subprocess.call([sys.executable, "-m", "cProfile", "-s", "tottime", "run_mvk_server.py", port], cwd="hybrid_server", stdout=open("/tmp/stdout", 'w'), stderr=open("/tmp/stderr", "w"))
+# Alternative execution modes
+#os.execv(sys.executable, [sys.executable, "-m", "cProfile", "-s", "tottime", "run_mvk_server.py", port])