|
@@ -1,5 +1,5 @@
|
|
|
import subprocess
|
|
|
-
|
|
|
+import os
|
|
|
# 定义要启动的应用及其路径和端口
|
|
|
services = [
|
|
|
("data_processing/data_operation/data_join.py", 10094),
|
|
@@ -17,11 +17,15 @@ services = [
|
|
|
("models_processing/model_predict/model_prediction_lstm.py", 10097),
|
|
|
]
|
|
|
|
|
|
+# 获取当前脚本所在的根目录
|
|
|
+base_dir = os.path.abspath(os.path.dirname(__file__))
|
|
|
# 启动所有服务
|
|
|
processes = []
|
|
|
for service, port in services:
|
|
|
+ service_path = os.path.join(base_dir, service)
|
|
|
+ service_dir = os.path.dirname(service_path)
|
|
|
print(f"Starting {service} on port {port}")
|
|
|
- p = subprocess.Popen(["python", service])
|
|
|
+ p = subprocess.Popen(["python", service_path], cwd=base_dir) # 设置工作目录为项目根目录
|
|
|
processes.append(p)
|
|
|
|
|
|
# 等待所有进程结束
|