fix: replace duplicate submissions while refilling queues
This commit is contained in:
@@ -246,6 +246,15 @@ CAPACITY_ERROR_MARKERS = (
|
||||
"active task limit",
|
||||
)
|
||||
|
||||
DUPLICATE_SUBMISSION_MARKERS = (
|
||||
"正在验证中",
|
||||
"请勿重复提交",
|
||||
"重复提交",
|
||||
"already validating",
|
||||
"already being validated",
|
||||
"already in progress",
|
||||
)
|
||||
|
||||
|
||||
def is_capacity_error(error: ModelHubAPIError) -> bool:
|
||||
if error.code in {409, 429}:
|
||||
@@ -256,6 +265,13 @@ def is_capacity_error(error: ModelHubAPIError) -> bool:
|
||||
return any(marker in message for marker in CAPACITY_ERROR_MARKERS)
|
||||
|
||||
|
||||
def is_duplicate_submission_error(error: ModelHubAPIError) -> bool:
|
||||
message = str(error).strip().lower()
|
||||
if isinstance(error.payload, dict):
|
||||
message = f"{message} {error.payload.get('message') or ''}".lower()
|
||||
return any(marker in message for marker in DUPLICATE_SUBMISSION_MARKERS)
|
||||
|
||||
|
||||
class ModelHubClientPool:
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user