fix: 移除 sage 引用,改为通用 APP_ROOT

This commit is contained in:
yumoqing 2026-06-11 17:46:45 +08:00
parent 2448ad45f7
commit 0dea29e3af
2 changed files with 12 additions and 13 deletions

View File

@ -13,7 +13,7 @@
## 架构 ## 架构
``` ```
宿主应用 (pipeline-app / sage / 其他) 宿主应用 (pipeline-app / 其他)
├── load_pipeline_service() ← 注册函数到 ServerEnv ├── load_pipeline_service() ← 注册函数到 ServerEnv

View File

@ -12,23 +12,22 @@ import subprocess
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
# Find Sage root # Find app root (pipeline-app or any ahserver app)
SAGE_ROOT = None APP_ROOT = None
for candidate in [ for candidate in [
os.path.join(SCRIPT_DIR, "..", ".."), os.path.join(SCRIPT_DIR, "..", ".."),
os.path.expanduser("~/repos/sage"), os.path.expanduser("~/test/pipeline-app"),
os.path.expanduser("~/sage"),
]: ]:
if os.path.isdir(os.path.join(candidate, "wwwroot")) and os.path.isdir(os.path.join(candidate, "py3")): if os.path.isdir(os.path.join(candidate, "wwwroot")) and os.path.isdir(os.path.join(candidate, "py3")):
SAGE_ROOT = os.path.abspath(candidate) APP_ROOT = os.path.abspath(candidate)
break break
if not SAGE_ROOT: if not APP_ROOT:
print("ERROR: Cannot find Sage root directory") print("ERROR: Cannot find app root directory")
sys.exit(1) sys.exit(1)
SET_ROLE_PERM = os.path.join(SAGE_ROOT, "set_role_perm.py") SET_ROLE_PERM = os.path.join(APP_ROOT, "set_role_perm.py")
PYTHON = os.path.join(SAGE_ROOT, "py3", "bin", "python") PYTHON = os.path.join(APP_ROOT, "py3", "bin", "python")
# pipeline_service is a backend-only module, no wwwroot paths needed. # pipeline_service is a backend-only module, no wwwroot paths needed.
# The host app's load_path.py handles the dspy paths that call pipeline_submit etc. # The host app's load_path.py handles the dspy paths that call pipeline_submit etc.
@ -40,17 +39,17 @@ PATHS_ANY = []
def register_paths(): def register_paths():
for path in PATHS_ANY: for path in PATHS_ANY:
subprocess.run([PYTHON, SET_ROLE_PERM, "any", path], cwd=SAGE_ROOT) subprocess.run([PYTHON, SET_ROLE_PERM, "any", path], cwd=APP_ROOT)
print(f" any: {path}") print(f" any: {path}")
for path in PATHS_LOGINED: for path in PATHS_LOGINED:
subprocess.run([PYTHON, SET_ROLE_PERM, "logined", path], cwd=SAGE_ROOT) subprocess.run([PYTHON, SET_ROLE_PERM, "logined", path], cwd=APP_ROOT)
print(f" logined: {path}") print(f" logined: {path}")
if __name__ == "__main__": if __name__ == "__main__":
print(f"=== pipeline_service RBAC registration ===") print(f"=== pipeline_service RBAC registration ===")
print(f"Sage root: {SAGE_ROOT}") print(f"App root: {APP_ROOT}")
if not PATHS_LOGINED and not PATHS_ANY: if not PATHS_LOGINED and not PATHS_ANY:
print("No paths to register (backend-only module)") print("No paths to register (backend-only module)")
else: else: