Repository navigation
Upload scheduling facts alongside CI priority scores / 在 CI 优先级分数之外上传调度事实 - #5121
Conversation
- `ci_priority --facts-file` records each labelled job's classifier-credited facts, keyed by queue token, and merges the step's calls into one file. - Every setup job that adds `ci-job-*` labels uploads that file as the unarchived `scheduling-facts.json` artifact. - Scores, labels and job names are unchanged. OperatorX shards now get their queue tokens and scores from `ci_priority` so they appear in the facts.
|
Generally most InferenceX submissions don't need to add changes to the infx package. On the off chance they do, generally the diff is small. Please prompt your agent to clean your PR to keep your diff to only necessary & minimal changes too. We have an increased code quality bar for changes to the infx package. 中文大多数 InferenceX 提交通常不需要修改 infx 包。即使确实需要,改动通常也很小。请让你的 agent 清理 PR,使改动只包含必要且最小的内容。infx 包的改动有更高的代码质量要求。 |
| if criteria is not None: | ||
| entry = _entry_from_criteria(criteria, policy, entry) | ||
| node_count = entry.get("node-count", 1) | ||
| if not isinstance(node_count, int) or isinstance(node_count, bool) or node_count < 1: | ||
| raise ValueError(f"node-count must be a positive integer, got {node_count!r}") |
There was a problem hiding this comment.
🔴 Trusted external sweeps classified as patchwork can now fail in get-jobs, so no benchmarks run. On the base branch they ran at patchwork-score. job_facts always calls _entry_from_criteria, which raises "Unknown CI priority criteria" for any criterion the scoring policy lacks. calculate_priority returns before that check when patchwork is set (ci_priority.py:158-159). Fix: give job_facts the same patchwork short-circuit as calculate_priority, skipping projection and its criteria and node-count checks, so facts can never reject a job the scorer accepts.
Why this was flagged
trusted-external-sweep.yml:134-150 dispatches e2e-tests.yml from main with ref=mergeSha and changelog-head-ref set, so classify-priority runs with scope full. Its enum comes from that revision's configs/ci-priority.yaml (action.yml:75-80). The scorer uses .ci-priority at github.workflow_sha (e2e-tests.yml:251-256, 284-285, 344). A PR that adds a model-prefix key to ci-priority.yaml, and is also classified patchwork, yields criteria like ["patchwork",""]. annotate_jobs still scores these at patchwork-score, because calculate_priority returns at line 158-159 without validating. With --facts-file (e2e-tests.yml:348), scheduling_facts then calls job_facts. At line 240-241, job_facts calls _entry_from_criteria, which raises ValueError at line 110-112. score_matrix exits non-zero, the get-jobs step fails and no sweep runs. On the base branch this run scored every job at patchwork-score and proceeded.
Verification: In ci_priority.py, calculate_priority returns before any criteria validation when patchwork is set (lines 158-159). The new job_facts has no such short-circuit. Lines 240-241 call _entry_from_criteria whenever criteria is not None, and lines 110-112 raise ValueError("Unknown CI priority criteria: ..."). So the exception exits get-jobs non-zero and no benchmarks run.
| def _score_from_facts(run, job, policy): | ||
| """Score facts the way the priority scheduler does, to prove they carry the whole score.""" | ||
| adjustments = policy["adjustments"] | ||
| if run["patchwork"]: | ||
| return Decimal(str(policy["patchwork-score"])).quantize(Decimal("0.001")) | ||
| score = Decimal(str(policy["base-score"])) | ||
| score += Decimal(str(adjustments.get("event", {}).get(run["event"], 0))) | ||
| score += Decimal(str(adjustments.get("additional-node", 0))) * (job["node-count"] - 1) | ||
| for flag in ("multi-node", "agentic", "eval-only"): | ||
| if job[flag]: | ||
| score += Decimal(str(adjustments.get(flag, 0))) | ||
| for field in ("precision", "spec-decoding", "model-prefix"): | ||
| score += Decimal(str(adjustments.get(field, {}).get(job[field], 0))) | ||
| framework = job["framework"] | ||
| score += next( | ||
| (Decimal(str(weight)) for prefix, weight in adjustments["framework-prefix"].items() | ||
| if framework == prefix or framework.startswith(f"{prefix}-")), | ||
| Decimal(0), | ||
| ) | ||
| if run["checklist-complete"]: | ||
| score += Decimal(str(adjustments.get("checklist-complete", 0))) | ||
| return score.quantize(Decimal("0.001")) | ||
|
|
There was a problem hiding this comment.
🟡 (optional) The new test copies the priority scoring formula into the test file, which the repo's test rules forbid. Maintainers end up with a second scorer to keep in sync. _score_from_facts rebuilds calculate_priority (base score, event, additional-node, flags, prefix match, checklist) and checks it against the real scorer. CONTRIBUTING.md item 6 bans exactly this kind of in-test reference implementation. Fix: delete _score_from_facts and test_scheduling_facts_reproduce_every_annotated_priority. Instead, assert concrete expected facts dicts for chosen criteria, as test_scheduling_facts_omit_values_the_classifier_did_not_credit already does.
Why this was flagged
AGENTS.md:62 says tests that 'reimplement the code' must be deleted. CONTRIBUTING.md:249 (item 6) bans any 'formula ... copied into the test file so the test can run against the copy', including 'reference specs cross-checked against a second in-test implementation'. _score_from_facts (test_ci_priority.py:234-256) is a line-for-line copy of calculate_priority in ci_priority.py. test_scheduling_facts_reproduce_every_annotated_priority then compares the copy against annotate_jobs output. If the policy semantics change, both copies have to be edited together. The test only proves the two copies agree. It never checks a concrete expected value for job_facts. The base branch has no such mirror implementation.
Verification: nit. The test file now holds a second copy of the scoring formula. _score_from_facts (test_ci_priority.py, added near lines 234-256) does the same steps as calculate_priority (ci_priority.py:151-193) in the same order. test_scheduling_facts_reproduce_every_annotated_priority then checks the real scorer against the in-test copy, which CONTRIBUTING.md:249 (item 6) bans.
- Patchwork runs score patchwork-score without criteria checks. Facts recording now skips the same projection and node-count checks, so a criterion the policy lacks no longer fails setup. - Test facts by rebuilding entries and scoring them with `calculate_priority` instead of a copied formula.
Summary
This is the first step of moving CI priority scoring to the priority scheduler. Setup jobs now also upload the facts each job's score comes from, while scoring stays as it is. The scheduler can collect and check those facts before it starts scoring jobs with them.
ci_prioritygains--facts-file. It records every labelled job's facts, keyed by queue token: framework, model prefix, precision, speculative decoding, agentic, eval-only, multi-node and node count, after the same classifier projection the scorer applies. It also records run-level event, patchwork and checklist-complete. Repeated calls in one setup step merge into one file.PRIORITY_SCHEDULER_ENABLEDis true, each setup job that addsci-job-*labels uploads the file as the unarchivedscheduling-facts.jsonartifact. That coverse2e-tests,run-sweep,profile,collectivex-sweep,operatorx-sweepandspeedbench-al.ci-job-<score>-<token>labels and job names are unchanged.ci_priorityrather thanoperatorx/ci.py, so their tokens appear in the facts. Each shard's score is unchanged (the sameoperatorxentry as before).The follow-up (#5085) removes the scores, labels and weights from this repository once the scheduler scores from these facts.
Validation details
A throwaway workflow (run) confirmed the artifact mechanics. An
archive: falseupload is served as raw JSON from the artifact download endpoint. Re-running failed jobs keeps attempt 1's artifact. A full re-run withoverwrite: truereplaces it.A full generated matrix (1,653 jobs) was annotated with three criteria sets: unscoped, partially credited, and patchwork. Rescoring each job from its facts with the same weights reproduced its
priorityvalue in every case.AI model disclosure
PR checklist and change type
Type of Change
Checklist
python -m infx.matrix.changed --base origin/mainlists affected config keys, I have appended one new entry covering them to the physical end ofinferencex-e2e/perf-changelog.yaml; if it lists none, I have added none. I have not edited historical entriesinferencex-e2e/perf-changelog.yamlentry, it carries exactly one primary sweep label (a maintainer applies it on fork PRs):full-sweep-fail-fast(recommended),full-sweep-enabled, ornon-canary-full-sweep-enabled. Optional modifiersall-evals,evals-only, andagentx-fastrequire a primary label; the last two block reuse while applied./use <run_id>(or the legacy/reuse-sweep-run) on this PR. Do this only once there is a final full sweep that is all green with evals passing, since after this comment the primary sweep label will no longer automatically kick off new sweeps. Remove and re-add the primary sweep label to force a new sweep.中文
将 CI 优先级打分迁移到优先级调度器的第一步:在保持现有打分的同时,setup 任务额外上传每个任务分数所依据的事实,供调度器在正式改用之前收集和核对。
ci_priority新增--facts-file,按 queue token 记录每个带标签任务经分类器投影后的事实(框架、模型前缀、精度、投机解码、agentic、eval-only、多节点、节点数),以及运行级别的事件、patchwork 与 checklist 完成情况。同一步骤内多次调用会合并到同一个文件。PRIORITY_SCHEDULER_ENABLED为 true 时,所有添加ci-job-*标签的 setup 任务都会将该文件作为未压缩的scheduling-facts.jsonartifact 上传(e2e-tests、run-sweep、profile、collectivex-sweep、operatorx-sweep、speedbench-al)。ci-job-<score>-<token>标签和任务名均保持不变。ci_priority生成 queue token 与分数,使其出现在事实文件中;每个分片的分数不变。后续 PR(#5085)将在调度器改用这些事实打分后,从本仓库移除分数、标签中的分数与权重。
验证:使用完整生成的矩阵(1,653 个任务)在未分类、部分加分和 patchwork 三种条件下测试,按事实重新打分的结果与每个任务的
priority完全一致。AI 模型说明:anthropic/claude-opus-5-5(运行时报告),负责实现、测试与 PR 描述。