forked from mtusi2026/mtusi2026lab6
ЛР6: OTel SDK, Collector, Prometheus/Loki/Tempo, Grafana, alerts, dashboard, тесты инцидентов
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Операторский replay failed-job. Запуск: python scripts/replay-failed.py <job_id>."""
|
||||
import sys
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from app import db, jobs # noqa: E402
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
sys.exit("usage: replay-failed.py <job_id>")
|
||||
try:
|
||||
job_id = uuid.UUID(sys.argv[1])
|
||||
except ValueError:
|
||||
sys.exit("invalid job_id")
|
||||
with db.connection() as conn:
|
||||
payload = jobs.replay_failed(conn, job_id)
|
||||
if payload is None:
|
||||
sys.exit("job not found or not in failed state")
|
||||
print("requeued:", payload["job_id"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user