Подтвердить трек 2 реальными сбоями, нагрузкой и отчётом

This commit is contained in:
2026-11-20 07:05:16 +03:00
parent 42bf6aa702
commit ef1f470659
43 changed files with 11538 additions and 30 deletions
+22
View File
@@ -0,0 +1,22 @@
"""Публичная нагрузка сообщений с отдельными cgroup CPU/memory snapshots."""
import json
from pathlib import Path
import subprocess
import sys
import time
ROOT = Path(__file__).resolve().parents[1]
command = [sys.executable, '-X', 'utf8', 'tests/load.py', '--base-url', 'http://127.0.0.1:8085',
'--duration', '30', '--concurrency', '4', '--output', 'evidence/load-messages.json']
with (ROOT / 'evidence/load-messages-run.txt').open('w', encoding='utf-8') as output:
process = subprocess.Popen(command, cwd=ROOT, stdout=output, stderr=subprocess.STDOUT)
samples = []
start = time.monotonic()
while process.poll() is None:
ids = subprocess.check_output(['docker', 'compose', '-p', 'lyakhonov-lab5', 'ps', '-q'], cwd=ROOT, text=True).split()
stats = subprocess.check_output(['docker', 'stats', '--no-stream', '--format', '{{json .}}', *ids], text=True)
samples.append(dict(at_seconds=round(time.monotonic()-start, 3), containers=[json.loads(x) for x in stats.splitlines()]))
time.sleep(2)
code = process.wait()
(ROOT / 'evidence/load-messages-resources.json').write_text(json.dumps(dict(command=command, exit_code=code, samples=samples), indent=2), encoding='utf-8')
raise SystemExit(code)