kin: auto-commit after pipeline
This commit is contained in:
parent
f1935d2af2
commit
d42ee4246d
3 changed files with 113 additions and 138 deletions
|
|
@ -51,6 +51,25 @@ def _check_dead_pipelines(db_path: Path) -> None:
|
|||
except Exception as upd_exc:
|
||||
_logger.error("Watchdog: failed to update pipeline/task: %s", upd_exc)
|
||||
# else: PermissionError (EACCES) — process exists but we can't signal it, skip
|
||||
|
||||
# Cleanup stale pipelines with no PID (zombie entries)
|
||||
try:
|
||||
stale = conn.execute(
|
||||
"SELECT id, task_id FROM pipelines WHERE status = 'running' AND pid IS NULL "
|
||||
"AND created_at < datetime('now', '-2 hours')"
|
||||
).fetchall()
|
||||
for row in stale:
|
||||
_logger.warning(
|
||||
"Watchdog: stale pipeline %s (no PID) — marking failed (%s)",
|
||||
row["id"], row["task_id"],
|
||||
)
|
||||
models.update_pipeline(conn, row["id"], status="failed")
|
||||
models.update_task(
|
||||
conn, row["task_id"], status="blocked",
|
||||
blocked_reason="Stale pipeline (no PID recorded)",
|
||||
)
|
||||
except Exception as stale_exc:
|
||||
_logger.error("Watchdog: stale cleanup failed: %s", stale_exc)
|
||||
except Exception as exc:
|
||||
_logger.error("Watchdog pass failed: %s", exc)
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue