fix: restore accuracy-first route admission
This commit is contained in:
@@ -38,6 +38,7 @@ def parse_model_submission_precheck(payload: Any) -> dict[str, Any]:
|
||||
raise ModelHubAPIError("Community model precheck verifyResult is invalid", payload=payload)
|
||||
|
||||
blocked_gpus: set[str] = set()
|
||||
successful_gpus: set[str] = set()
|
||||
failed_frameworks_by_gpu: dict[str, set[str]] = {}
|
||||
for gpu, gpu_result in verify_result.items():
|
||||
name = str(gpu)
|
||||
@@ -48,6 +49,12 @@ def parse_model_submission_precheck(payload: Any) -> dict[str, Any]:
|
||||
records = gpu_result.get("records")
|
||||
if status == "未验证" and isinstance(records, list) and not records:
|
||||
continue
|
||||
blocked_gpus.add(name)
|
||||
if status == "已验证" or any(
|
||||
isinstance(record, dict) and _positive_verify_result(record.get("verifyResult"))
|
||||
for record in (records or [])
|
||||
):
|
||||
successful_gpus.add(name)
|
||||
if status == "验证失败" and isinstance(records, list) and records:
|
||||
frameworks: set[str] = set()
|
||||
for record in records:
|
||||
@@ -63,20 +70,26 @@ def parse_model_submission_precheck(payload: Any) -> dict[str, Any]:
|
||||
frameworks.add(framework)
|
||||
else:
|
||||
failed_frameworks_by_gpu[name] = frameworks
|
||||
continue
|
||||
# Verified, validating and unknown states remain closed. A failed GPU
|
||||
# opens only for a different framework with explicit failed records.
|
||||
blocked_gpus.add(name)
|
||||
# Accuracy-first admission: any existing model/GPU state remains
|
||||
# closed. Failed-framework details are diagnostic evidence only.
|
||||
|
||||
return {
|
||||
"isInDB": data.get("isInDB") is True,
|
||||
"processedGpus": blocked_gpus,
|
||||
"successfulGpus": successful_gpus,
|
||||
"failedFrameworksByGpu": failed_frameworks_by_gpu,
|
||||
"verifyResult": verify_result,
|
||||
"modelInfo": data.get("modelInfo") if isinstance(data.get("modelInfo"), dict) else {},
|
||||
}
|
||||
|
||||
|
||||
def _positive_verify_result(value: Any) -> bool:
|
||||
try:
|
||||
return int(value) > 0
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
|
||||
|
||||
class ModelHubClient:
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user