v1.0.99: debug logging for save_run — will show why it fails

This commit is contained in:
2026-07-28 10:42:43 +04:00
parent 10ec617c74
commit 3dbddda858
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -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")
+2
View File
@@ -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()
+4 -2
View File
@@ -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: