feat: compact durable logs and refine framework routing

This commit is contained in:
CoolBoy
2026-09-04 10:30:21 +08:00
parent 5b1ec4d3eb
commit ff73768537
13 changed files with 621 additions and 44 deletions

View File

@@ -319,6 +319,45 @@ class ClientPoolConcurrencyTests(unittest.TestCase):
self.assertEqual("age_policy_skipped", result["reason"])
self.assertEqual([], client.submitted)
def test_submit_capacity_exhaustion_is_deferred_not_failed(self) -> None:
class CapacityClient:
@staticmethod
def add_task(_payload): # noqa: ANN001, ANN205
raise ModelHubAPIError("当前等待中或运行中的异步模型验证任务数量已达上限100")
result = submit_candidate(
{
"repoId": "owner/model",
"modelAddress": "https://modelscope.cn/models/owner/model",
"targetGpu": "gpu-a",
"framework": "vllm",
"taskType": "text-generation",
"configParams": "safe",
},
CapacityClient(), # type: ignore[arg-type]
)
self.assertEqual("capacity_deferred", result["outcome"])
self.assertEqual("account_capacity_saturated", result["reason"])
def test_transformers_platform_prerequisite_is_deferred_not_failed(self) -> None:
class PrerequisiteClient:
@staticmethod
def add_task(_payload): # noqa: ANN001, ANN205
raise ModelHubAPIError("该模型必须在非transformers框架验证失败后才可以开启transformers框架验证任务")
result = submit_candidate(
{
"repoId": "owner/model",
"modelAddress": "https://modelscope.cn/models/owner/model",
"targetGpu": "gpu-a",
"framework": "transformers",
"taskType": "text-generation",
"configParams": "safe",
},
PrerequisiteClient(), # type: ignore[arg-type]
)
self.assertEqual("framework_prerequisite_deferred", result["outcome"])
def test_age_policy_deferred_candidate_is_skipped_not_failed(self) -> None:
class AdmissionRaceClient:
@staticmethod