feat: add adaptive GPU scheduling
This commit is contained in:
@@ -231,23 +231,32 @@ def summarize_records(records: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
|
||||
|
||||
def is_success(record: dict[str, Any]) -> bool:
|
||||
verify_result = record.get("verifyResult")
|
||||
verify_result = _numeric_verify_result(record.get("verifyResult"))
|
||||
status = str(record.get("status") or "").lower()
|
||||
return verify_result is not None and verify_result > 0 and status == "success"
|
||||
|
||||
|
||||
def is_failure(record: dict[str, Any]) -> bool:
|
||||
verify_result = record.get("verifyResult")
|
||||
verify_result = _numeric_verify_result(record.get("verifyResult"))
|
||||
status = str(record.get("status") or "").lower()
|
||||
if verify_result is not None and verify_result < 0:
|
||||
return True
|
||||
return status in {"failed", "error", "cancelled"}
|
||||
return status in {"failed", "error", "cancelled", "canceled", "rejected", "timeout"}
|
||||
|
||||
|
||||
def _numeric_verify_result(value: Any) -> float | None:
|
||||
if value in (None, ""):
|
||||
return None
|
||||
try:
|
||||
return float(value)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
def classify_failure(record: dict[str, Any]) -> str:
|
||||
status = str(record.get("status") or "").lower()
|
||||
verify_result = record.get("verifyResult")
|
||||
if status in {"failed", "error", "cancelled"}:
|
||||
verify_result = _numeric_verify_result(record.get("verifyResult"))
|
||||
if status in {"failed", "error", "cancelled", "canceled", "rejected", "timeout"}:
|
||||
return "参数/模板问题"
|
||||
if status in WAITING_STATUSES or status in RUNNING_STATUSES or verify_result is None:
|
||||
return "排队中/未知"
|
||||
|
||||
Reference in New Issue
Block a user