pipeline-service/scripts/load_path.py
yumoqing 2448ad45f7 refactor: 改造为通用产线执行引擎模块
- 去掉独立 aiohttp 服务器,改为标准模块(load_pipeline_service)
- 存储从文件系统改 MySQL(sqlor)
- 新增 3 张数据表:pipeline_tasks/task_steps/artifacts
- 多租户隔离(tenant_id)
- 通用 DAG 调度引擎(读 pipeline_steps 表,不硬编码业务)
- 可插拔步骤处理器(register_handler by step_type)
- artifact 版本管理 + 级联重跑
- init/data.json 标准 appcodes 格式
- 完整 README 文档
2026-06-11 17:30:06 +08:00

59 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""pipeline_service 模块 RBAC 权限注册。
注意: pipeline_service 是纯后端引擎模块,无 wwwroot 前端文件。
此脚本仅注册模块 API 可能被引用的路径。
宿主应用的 load_path.py 负责注册实际的 dspy 路径。
"""
import os
import sys
import subprocess
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
# Find Sage root
SAGE_ROOT = None
for candidate in [
os.path.join(SCRIPT_DIR, "..", ".."),
os.path.expanduser("~/repos/sage"),
os.path.expanduser("~/sage"),
]:
if os.path.isdir(os.path.join(candidate, "wwwroot")) and os.path.isdir(os.path.join(candidate, "py3")):
SAGE_ROOT = os.path.abspath(candidate)
break
if not SAGE_ROOT:
print("ERROR: Cannot find Sage 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")
# 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.
# This script exists for consistency and future extensibility.
PATHS_LOGINED = []
PATHS_ANY = []
def register_paths():
for path in PATHS_ANY:
subprocess.run([PYTHON, SET_ROLE_PERM, "any", path], cwd=SAGE_ROOT)
print(f" any: {path}")
for path in PATHS_LOGINED:
subprocess.run([PYTHON, SET_ROLE_PERM, "logined", path], cwd=SAGE_ROOT)
print(f" logined: {path}")
if __name__ == "__main__":
print(f"=== pipeline_service RBAC registration ===")
print(f"Sage root: {SAGE_ROOT}")
if not PATHS_LOGINED and not PATHS_ANY:
print("No paths to register (backend-only module)")
else:
register_paths()
print("Done.")