Upraveno. Portál už neurčuje readiness podle job.status == success ani podle žádné Docker/group logiky.

Teď READY / NOT READY bere jen z explicitního výstupu skriptu uloženého v DB:

result_json.ready jako boolean,
result_json.readiness / migration_readiness s hodnotou READY nebo NOT READY,
případně text READY / NOT READY v uloženém raw výstupu jobu.
This commit is contained in:
JiriUhlir
2026-06-08 07:53:21 +02:00
parent 2f5b5bcb89
commit ad0b35c09f
2 changed files with 28 additions and 16 deletions
+27 -15
View File
@@ -89,6 +89,32 @@ def _first_int(data: dict[str, Any], keys: tuple[str, ...]) -> int | None:
return None
def _readiness_from_script_output(result_data: dict[str, Any], combined_text: str) -> bool:
ready_value = result_data.get("ready")
if isinstance(ready_value, bool):
return ready_value
readiness_value = str(
result_data.get("readiness")
or result_data.get("migration_readiness")
or result_data.get("migrationReadiness")
or ""
).strip().upper()
if readiness_value == "READY":
return True
if readiness_value == "NOT READY":
return False
upper_text = combined_text.upper()
if re.search(r"(?<![A-Z0-9_])NOT\s+READY(?![A-Z0-9_])", upper_text):
return False
if re.search(r"(?<![A-Z0-9_])READY(?![A-Z0-9_])", upper_text):
return True
return False
def summarize_readiness(job: dict[str, Any] | None) -> dict[str, Any]:
if not job:
return {
@@ -123,22 +149,8 @@ def summarize_readiness(job: dict[str, Any] | None) -> dict[str, Any]:
if fail_count is None:
fail_count = _count_token(combined_text, "FAIL")
readiness_value = str(
result_data.get("readiness")
or result_data.get("ready")
or result_data.get("status")
or ""
).strip().upper()
if readiness_value in {"READY", "TRUE", "OK", "SUCCESS"}:
ready = fail_count == 0 and (job.get("status") or "").lower() == "success"
elif readiness_value in {"NOT READY", "FALSE", "FAIL", "FAILED", "ERROR"}:
ready = False
else:
ready = fail_count == 0 and (job.get("status") or "").lower() == "success"
return {
"ready": ready,
"ready": _readiness_from_script_output(result_data, combined_text),
"ok_count": ok_count,
"warn_count": warn_count,
"fail_count": fail_count,