kin: auto-commit after pipeline
This commit is contained in:
parent
76a88714e4
commit
4bc421e117
5 changed files with 195 additions and 6 deletions
|
|
@ -357,3 +357,44 @@ def test_check_dead_pipelines_permission_error_ignored(tmp_path):
|
|||
|
||||
assert task["status"] != "blocked"
|
||||
assert pipeline_row["status"] == "running"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _check_parent_alive: EACCES и ProcessLookupError (KIN-099, решения #341/#358)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_check_parent_alive_eacces_does_not_abort(conn):
|
||||
"""EACCES при os.kill(ppid, 0) — процесс жив (нет прав) → pipeline продолжается (решение #358)."""
|
||||
import errno as _errno
|
||||
from agents.runner import _check_parent_alive
|
||||
|
||||
pipeline = models.create_pipeline(conn, "VDOL-001", "vdol", "custom", [])
|
||||
eacces_ppid = 99990
|
||||
|
||||
with patch("agents.runner.os.getppid", return_value=eacces_ppid), \
|
||||
patch("agents.runner.os.kill", side_effect=OSError(_errno.EACCES, "Operation not permitted")):
|
||||
result = _check_parent_alive(conn, pipeline, "VDOL-001", "vdol")
|
||||
|
||||
assert result is False
|
||||
|
||||
task = models.get_task(conn, "VDOL-001")
|
||||
assert task["status"] != "blocked"
|
||||
|
||||
|
||||
def test_check_parent_alive_process_lookup_error_aborts(conn):
|
||||
"""ProcessLookupError (errno=ESRCH) при os.kill → pipeline прерывается (решение #341)."""
|
||||
import errno as _errno
|
||||
from agents.runner import _check_parent_alive
|
||||
|
||||
pipeline = models.create_pipeline(conn, "VDOL-001", "vdol", "custom", [])
|
||||
dead_ppid = 99991
|
||||
|
||||
with patch("agents.runner.os.getppid", return_value=dead_ppid), \
|
||||
patch("agents.runner.os.kill", side_effect=ProcessLookupError(_errno.ESRCH, "No such process")):
|
||||
result = _check_parent_alive(conn, pipeline, "VDOL-001", "vdol")
|
||||
|
||||
assert result is True
|
||||
|
||||
task = models.get_task(conn, "VDOL-001")
|
||||
assert task["status"] == "blocked"
|
||||
assert str(dead_ppid) in (task.get("blocked_reason") or "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue