fix: 移除 sage 引用,改为通用 APP_ROOT
This commit is contained in:
parent
2448ad45f7
commit
0dea29e3af
@ -13,7 +13,7 @@
|
||||
## 架构
|
||||
|
||||
```
|
||||
宿主应用 (pipeline-app / sage / 其他)
|
||||
宿主应用 (pipeline-app / 其他)
|
||||
│
|
||||
├── load_pipeline_service() ← 注册函数到 ServerEnv
|
||||
│
|
||||
|
||||
@ -12,23 +12,22 @@ import subprocess
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# Find Sage root
|
||||
SAGE_ROOT = None
|
||||
# Find app root (pipeline-app or any ahserver app)
|
||||
APP_ROOT = None
|
||||
for candidate in [
|
||||
os.path.join(SCRIPT_DIR, "..", ".."),
|
||||
os.path.expanduser("~/repos/sage"),
|
||||
os.path.expanduser("~/sage"),
|
||||
os.path.expanduser("~/test/pipeline-app"),
|
||||
]:
|
||||
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
|
||||
|
||||
if not SAGE_ROOT:
|
||||
print("ERROR: Cannot find Sage root directory")
|
||||
if not APP_ROOT:
|
||||
print("ERROR: Cannot find app root directory")
|
||||
sys.exit(1)
|
||||
|
||||
SET_ROLE_PERM = os.path.join(SAGE_ROOT, "set_role_perm.py")
|
||||
PYTHON = os.path.join(SAGE_ROOT, "py3", "bin", "python")
|
||||
SET_ROLE_PERM = os.path.join(APP_ROOT, "set_role_perm.py")
|
||||
PYTHON = os.path.join(APP_ROOT, "py3", "bin", "python")
|
||||
|
||||
# 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.
|
||||
@ -40,17 +39,17 @@ PATHS_ANY = []
|
||||
|
||||
def register_paths():
|
||||
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}")
|
||||
|
||||
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}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
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:
|
||||
print("No paths to register (backend-only module)")
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user