feat: improve route throughput and reconcile delayed validation outcomes

This commit is contained in:
CoolBoy committed 2026-11-12 03:10:51 +08:00
1 parent 5dead8172c
commit 43ecd36c0e
13 files changed
+468 -83

No files matched your search

+22 -9
View File
@@ -1699,7 +1699,10 @@ def run_submission(
capacity_saturated = False
if args.dry_run:
attempted_candidates = diversified_candidates[:target_submit_count]
attempted_candidates = filter_profile_batch(
diversified_candidates, outcome_tracker.pending_records(), outcome_tracker.get_stats_report(),
max_selected=target_submit_count,
)[0]
else:
claim_store = SubmissionClaimStore(
Path(getattr(args, "claims_path", DEFAULT_CLAIMS_PATH)),
@@ -1718,28 +1721,38 @@ def run_submission(
# already-scanned pool until the desired number of real submissions is
# reached or account capacity is genuinely exhausted.
while len(submitted) < target_submit_count and len(attempted_candidates) < max_submit_attempts:
submitted_models = {row["repoId"] for row in submitted}
remaining_candidates = [
candidate
for candidate in diversified_candidates
if candidate_key(candidate) not in attempted_keys
and candidate["repoId"] not in submitted_models
and not submission_exclusion_store.is_blocked(candidate["repoId"], candidate["targetGpu"])
]
remaining_candidates = one_candidate_per_model(remaining_candidates)
remaining_candidates, profile_deferred = filter_profile_batch(
remaining_candidates, outcome_tracker.pending_records(), profile_stats,
)
for candidate in profile_deferred:
attempted_keys.add(candidate_key(candidate))
skipped.append({"repoId": candidate["repoId"], "targetGpu": candidate["targetGpu"],
"reason": "profile_feedback_deferred", "deferred": True})
desired_count = min(
target_submit_count - len(submitted),
max_submit_attempts - len(attempted_candidates),
)
if state_sync is not None:
desired_count = min(desired_count, int(state_sync.batch_size))
remaining_candidates, profile_deferred = filter_profile_batch(
remaining_candidates, outcome_tracker.pending_records(), profile_stats,
max_selected=desired_count,
)
for candidate in profile_deferred:
attempted_keys.add(candidate_key(candidate))
skipped.append({"repoId": candidate["repoId"], "targetGpu": candidate["targetGpu"],
"reason": "profile_feedback_deferred", "deferred": True})
batch_candidates = claim_store.claim(remaining_candidates, limit=desired_count)
claimed_keys = {candidate_key(candidate) for candidate in batch_candidates}
for candidate in remaining_candidates:
if candidate_key(candidate) not in claimed_keys:
attempted_keys.add(candidate_key(candidate))
skipped.append({"repoId": candidate["repoId"], "targetGpu": candidate["targetGpu"],
"reason": "route_claim_deferred", "deferred": True})
if not batch_candidates:
if remaining_candidates:
continue # A claimed first choice must not hide alternatives.
break
attempted_candidates.extend(batch_candidates)
attempted_keys.update(candidate_key(candidate) for candidate in batch_candidates)