v1.0.99: debug logging for save_run — will show why it fails
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ from routes.api import bp as api_bp
|
|||||||
from routes.api_test import bp as api_test_bp
|
from routes.api_test import bp as api_test_bp
|
||||||
|
|
||||||
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
||||||
VERSION = "1.0.98"
|
VERSION = "1.0.99"
|
||||||
|
|
||||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
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")
|
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ def save_run(client_id, stand, user_email, svc_id, svc_name, op_name, svc_op_id,
|
|||||||
"""Сохранить один запуск в таблицу runs."""
|
"""Сохранить один запуск в таблицу runs."""
|
||||||
conn = get_conn()
|
conn = get_conn()
|
||||||
if not conn:
|
if not conn:
|
||||||
|
print("[DB] save_run SKIP: no connection", flush=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -31,6 +32,7 @@ def save_run(client_id, stand, user_email, svc_id, svc_name, op_name, svc_op_id,
|
|||||||
))
|
))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
cur.close()
|
cur.close()
|
||||||
|
print(f"[DB] save_run OK: {op_name} {status} {duration_sec}s", flush=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[DB] save_run error: {e}", flush=True)
|
print(f"[DB] save_run error: {e}", flush=True)
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
|
|||||||
@@ -355,8 +355,10 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_
|
|||||||
params or {},
|
params or {},
|
||||||
op.get("stages", []),
|
op.get("stages", []),
|
||||||
current_app.config.get("VERSION", ""))
|
current_app.config.get("VERSION", ""))
|
||||||
except Exception:
|
except Exception as e:
|
||||||
pass # не ронять фоновый поток из-за БД
|
import traceback
|
||||||
|
print(f"[DB] save_run FAILED: {e}", flush=True)
|
||||||
|
traceback.print_exc()
|
||||||
return
|
return
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user