Document deployment and expose weight manifest
This commit is contained in:
@@ -78,6 +78,11 @@ def evaluate_project() -> dict:
|
||||
and "runtimeSelector" in frontend_text
|
||||
and "conda_env" in frontend_text
|
||||
and "request.conda_env" in jobs_text,
|
||||
"weight_manifest_ui": "WeightPanel" in frontend_text
|
||||
and "/api/weights" in frontend_text
|
||||
and "/api/weights/verify" in frontend_text
|
||||
and "weightList" in frontend_text
|
||||
and "weightFamilies" in frontend_text,
|
||||
"live_log_stream_ui": "EventSource" in frontend_text
|
||||
and "eventSourceRef" in frontend_text
|
||||
and "log_size" in frontend_text
|
||||
|
||||
@@ -5,10 +5,26 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _resolve_path(value: str | None, default: Path) -> Path:
|
||||
def _load_dotenv(path: Path) -> None:
|
||||
if not path.exists():
|
||||
return
|
||||
for raw_line in path.read_text(encoding="utf-8").splitlines():
|
||||
line = raw_line.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
if line.startswith("export "):
|
||||
line = line[len("export ") :].strip()
|
||||
key, value = line.split("=", 1)
|
||||
key = key.strip()
|
||||
value = value.strip().strip("'\"")
|
||||
if key:
|
||||
os.environ.setdefault(key, value)
|
||||
|
||||
|
||||
def _resolve_path(value: str | None, default: Path, base_dir: Path) -> Path:
|
||||
base = Path(value).expanduser() if value else default
|
||||
if not base.is_absolute():
|
||||
base = default.parent / base
|
||||
base = base_dir / base
|
||||
return base.resolve()
|
||||
|
||||
|
||||
@@ -27,17 +43,21 @@ class Settings:
|
||||
|
||||
|
||||
def get_settings() -> Settings:
|
||||
project_root = Path(os.getenv("SEG_DATA_SERVER_ROOT", Path(__file__).resolve().parents[2])).expanduser()
|
||||
default_project_root = Path(__file__).resolve().parents[2]
|
||||
_load_dotenv(default_project_root / ".env")
|
||||
|
||||
project_root = Path(os.getenv("SEG_DATA_SERVER_ROOT", default_project_root)).expanduser()
|
||||
if not project_root.is_absolute():
|
||||
project_root = (Path(__file__).resolve().parents[2] / project_root).resolve()
|
||||
project_root = (default_project_root / project_root).resolve()
|
||||
else:
|
||||
project_root = project_root.resolve()
|
||||
_load_dotenv(project_root / ".env")
|
||||
|
||||
sibling_source = project_root.parent / "Seg"
|
||||
default_source = sibling_source if sibling_source.exists() else project_root.parent
|
||||
source_root = _resolve_path(os.getenv("SEG_SOURCE_ROOT"), default_source)
|
||||
db_path = _resolve_path(os.getenv("SEG_BACKEND_DB"), project_root / "var" / "seg_data_server.sqlite3")
|
||||
log_dir = _resolve_path(os.getenv("SEG_BACKEND_LOG_DIR"), project_root / "var" / "job_logs")
|
||||
source_root = _resolve_path(os.getenv("SEG_SOURCE_ROOT"), default_source, project_root)
|
||||
db_path = _resolve_path(os.getenv("SEG_BACKEND_DB"), project_root / "var" / "seg_data_server.sqlite3", project_root)
|
||||
log_dir = _resolve_path(os.getenv("SEG_BACKEND_LOG_DIR"), project_root / "var" / "job_logs", project_root)
|
||||
weights_root = (project_root / "weights").resolve()
|
||||
|
||||
return Settings(
|
||||
|
||||
Reference in New Issue
Block a user