|
@@ -8,36 +8,40 @@ if len(sys.argv) < 2:
|
|
|
else:
|
|
|
port = sys.argv[1]
|
|
|
|
|
|
-# Start up the HUTN compilation service already
|
|
|
try:
|
|
|
- hutn = subprocess.Popen([sys.executable, "services/HUTN/main.py", "127.0.0.1:%s" % port])
|
|
|
- json = subprocess.Popen([sys.executable, "services/JSON/main.py", "127.0.0.1:%s" % port])
|
|
|
-
|
|
|
+ # Compile all SCCD models first
|
|
|
os.chdir("wrappers")
|
|
|
subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "modelverse_SCCD.xml"])
|
|
|
|
|
|
os.chdir("../hybrid_server")
|
|
|
subprocess.check_call([sys.executable, "-m", "sccd.compiler.sccdc", "-p", "threads", "server.xml"])
|
|
|
|
|
|
- program_to_execute = [sys.executable, "run_mvk_server.py", port]
|
|
|
+ os.chdir("..")
|
|
|
|
|
|
- # Alternative execution modes
|
|
|
- #program_to_execute = [sys.executable, "-m", "cProfile", "-s", "tottime", "run_mvk_server.py", port]
|
|
|
- #program_to_execute = [sys.executable, "run_mvk_server.py", port, "--kernel=interpreter"]
|
|
|
- #program_to_execute = [sys.executable, "run_mvk_server.py", port, "--kernel=fast-jit"]
|
|
|
+ # Start up all services with auto-detection
|
|
|
+ import glob
|
|
|
+ service_paths = glob.glob("services/*/main.py")
|
|
|
+ services = []
|
|
|
+ for service_path in service_paths:
|
|
|
+ print("[SERVICE] loaded " + service_path)
|
|
|
+ service = subprocess.Popen([sys.executable, service_path, "127.0.0.1:%s" % port])
|
|
|
+ services.append(service)
|
|
|
|
|
|
+ os.chdir("hybrid_server")
|
|
|
+ program_to_execute = [sys.executable, "run_mvk_server.py", port]
|
|
|
server = subprocess.Popen(program_to_execute)
|
|
|
+
|
|
|
server.wait()
|
|
|
finally:
|
|
|
+ # Stop the server
|
|
|
try:
|
|
|
server.terminate()
|
|
|
except:
|
|
|
pass
|
|
|
- try:
|
|
|
- hutn.terminate()
|
|
|
- except:
|
|
|
- pass
|
|
|
- try:
|
|
|
- json.terminate()
|
|
|
- except:
|
|
|
- pass
|
|
|
+
|
|
|
+ # Terminate all services as well
|
|
|
+ for service in services:
|
|
|
+ try:
|
|
|
+ service.terminate()
|
|
|
+ except:
|
|
|
+ pass
|