From 3dbddda85898a7510eb3763a7af0f84382506b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 28 Jul 2026 10:42:43 +0400 Subject: [PATCH] =?UTF-8?q?v1.0.99:=20debug=20logging=20for=20save=5Frun?= =?UTF-8?q?=20=E2=80=94=20will=20show=20why=20it=20fails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/app.py | 2 +- site/db/save_run.py | 2 ++ site/routes/api_test.py | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/site/app.py b/site/app.py index 1716460..84a23d7 100644 --- a/site/app.py +++ b/site/app.py @@ -18,7 +18,7 @@ from routes.api import bp as api_bp from routes.api_test import bp as api_test_bp # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. -VERSION = "1.0.98" +VERSION = "1.0.99" app = Flask(__name__, template_folder="templates", static_folder="static") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc") diff --git a/site/db/save_run.py b/site/db/save_run.py index 02c3eb7..5c9a990 100644 --- a/site/db/save_run.py +++ b/site/db/save_run.py @@ -12,6 +12,7 @@ def save_run(client_id, stand, user_email, svc_id, svc_name, op_name, svc_op_id, """Сохранить один запуск в таблицу runs.""" conn = get_conn() if not conn: + print("[DB] save_run SKIP: no connection", flush=True) return try: @@ -31,6 +32,7 @@ def save_run(client_id, stand, user_email, svc_id, svc_name, op_name, svc_op_id, )) conn.commit() cur.close() + print(f"[DB] save_run OK: {op_name} {status} {duration_sec}s", flush=True) except Exception as e: print(f"[DB] save_run error: {e}", flush=True) conn.rollback() diff --git a/site/routes/api_test.py b/site/routes/api_test.py index 8887bba..b594a1d 100644 --- a/site/routes/api_test.py +++ b/site/routes/api_test.py @@ -355,8 +355,10 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_ params or {}, op.get("stages", []), current_app.config.get("VERSION", "")) - except Exception: - pass # не ронять фоновый поток из-за БД + except Exception as e: + import traceback + print(f"[DB] save_run FAILED: {e}", flush=True) + traceback.print_exc() return time.sleep(5) except Exception: