ЛР 3 — БВТ2301 — Сафронов — на 5, трек 1 #6
@@ -175,9 +175,24 @@ def cleanup(project: str, containers: list[str]) -> bool:
|
||||
|
||||
def postgres_log_check(project: str) -> int:
|
||||
"""Журнал PostgreSQL стенда отказов: сводка всегда, признаки аварии —
|
||||
строками; 1 — признаки есть. Два счётчика
|
||||
строками; 1 — признаки есть или журнал не прочитан. Два счётчика
|
||||
FATAL показывают, что заполнение и освобождение слотов правда были."""
|
||||
log = dc(project, "logs", "--no-log-prefix", "postgres", quiet=True)
|
||||
log = dc(
|
||||
project,
|
||||
"logs",
|
||||
"--no-log-prefix",
|
||||
"postgres",
|
||||
check=False,
|
||||
quiet=True,
|
||||
)
|
||||
if log.returncode != 0:
|
||||
# сбой чтения журнала — не сбой подготовки стенда
|
||||
tail = log.stderr.strip().splitlines()[-1:] or ["no stderr"]
|
||||
say(
|
||||
f"postgres log unavailable: docker compose logs exited "
|
||||
f"{log.returncode}: {tail[0]}",
|
||||
)
|
||||
return 1
|
||||
lines = (log.stdout + log.stderr).splitlines()
|
||||
crashes = [line for line in lines if any(m in line for m in CRASH_MARKERS)]
|
||||
too_many = sum("too many clients" in line for line in lines)
|
||||
|
||||
Reference in New Issue
Block a user