deploy standalone ASR pipeline on tools-pve

This commit is contained in:
Codex
2026-09-18 02:32:14 -07:00
parent f30f72b295
commit b23f00f41a
38 changed files with 182773 additions and 0 deletions
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
"""Logging to both stderr and the shared log file.
Kept trivial and dependency-free on purpose: systemd captures stderr, while the
file gives the same `[timestamp] message` shape the legacy shell pipeline wrote,
so existing habits (`tail -f OBSIDIAN/logs/…`) keep working.
"""
from __future__ import annotations
import sys
import threading
import time
from .config import CFG
_lk = threading.Lock()
def log(msg: str, *, level: str = "INFO") -> None:
line = f"[{time.strftime('%F %T %z')}] {level}: {msg}"
with _lk:
print(line, file=sys.stderr, flush=True)
try:
CFG.log_file.parent.mkdir(parents=True, exist_ok=True)
with CFG.log_file.open("a", encoding="utf-8") as f:
f.write(line + "\n")
except Exception:
pass # never let logging break the pipeline