v1.0.75: keep displayName in operation status
This commit is contained in:
@@ -222,6 +222,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_
|
||||
# Обновляем stages по мере появления
|
||||
_op_results[op_uid] = {
|
||||
"status": "RUNNING",
|
||||
"displayName": display_name,
|
||||
"stages": op.get("stages", []),
|
||||
"duration": round(time.time() - t0, 1),
|
||||
}
|
||||
@@ -234,6 +235,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_
|
||||
tracker_remove(instance_uid)
|
||||
_op_results[op_uid] = {
|
||||
"status": "OK" if is_ok else "FAIL",
|
||||
"displayName": display_name,
|
||||
"error": str(err) if err else "",
|
||||
"stages": op.get("stages", []),
|
||||
"duration": round(time.time() - t0, 1),
|
||||
@@ -244,7 +246,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_
|
||||
import traceback
|
||||
print(f"[ERROR] _finish_op crashed: {traceback.format_exc()}", flush=True)
|
||||
time.sleep(5)
|
||||
_op_results[op_uid] = {"status": "TIMEOUT", "duration": round(time.time() - t0, 1)}
|
||||
_op_results[op_uid] = {"status": "TIMEOUT", "displayName": display_name, "duration": round(time.time() - t0, 1)}
|
||||
|
||||
|
||||
@bp.route("/api/test/status/<op_uid>")
|
||||
@@ -262,6 +264,7 @@ def api_test_status(op_uid):
|
||||
return jsonify({
|
||||
"status": "OK" if (done and op.get("isSuccessful")) else ("FAIL" if done else "RUNNING"),
|
||||
"done": done,
|
||||
"displayName": op.get("displayName"),
|
||||
"isSuccessful": op.get("isSuccessful"),
|
||||
"isInProgress": op.get("isInProgress"),
|
||||
"duration": op.get("duration"),
|
||||
|
||||
Reference in New Issue
Block a user