Repository navigation
fix(listener): admission 不再卡住 message loop,派發保守計費並於 JobStarted 重新歸屬 (#192) - #199
Merged
Merged
Conversation
- 新增 listener/ledger.go:已知指派、已退場 job id、runner 計費記錄由同一把鎖持有, committed 的 CPU/RAM/VRAM 改為對持有中 runner 的加總,不再增減計數器 - 已 started 或 completed 的 job id 不會再回到已知指派;已持有的 runner 名稱拒絕再次 dispatch; exit 只釋放自己 token 的記錄 - worker 結束時先釋放計費記錄,再釋放指派鍵,避免重送指派在空窗內以同名取代 - 新增 TestLedgerOrderInsensitive 與 TestAssignmentKeyHeldUntilWorkerRecordGone;ADR-0006、ADR-0007 與 CHANGELOG 同步
- 輪詢回歸測試(CPU):第一個 runner 真的佔住整個 budget,第二個不會被開出, 且第三個 message 的 AcquireJobs 照常進行。 - 輪詢回歸測試(GPU):卡已滿時不會開出 runner,也不會在卡上記帳。 - 釋放後再派發:第一個 runner 透過真正的結束流程釋放額度,不再直接改 ledger。 - 重新歸屬:JobStarted 的 job id 和 runner 被開出時的 assignment 不同,只有依 JIT runner 名稱比對才會通過;補上 GPU 未知 runner 不改變記帳的斷言。 - 新增 message loop 層級的測試:未知 runner 的 JobStarted 不改變任何記帳,但該 job 已開始,不再是已知 assignment,也不再影響下一個 runner 的保守計費。 - round4 測試改成等待准入探測,不再 sleep,結束時釋放 provisioner。
…ope 重試准入 (#192) - retire 的 job id 只保留最近 4096 個,超過就忘掉最舊的;ledger 註解、ADR-0006、 CHANGELOG 不再說「永遠不會再回到已知 assignment」。 - 未知 runner 的 JobStarted:不改變任何記帳,只記 log;但該 job 已開始,離開已 知 assignment,不再影響下一個 runner 的保守計費。ledger、listener、ADR-0006、 CHANGELOG、README 一致。 - Listen 註解:啟動、每個 message envelope(包含沒有 statistics 的)與空輪詢都 依最新的 statistics 重試准入。 - dispatch 註解:重送的 assignment 由 reserveAssignment 擋下;每次派發都有獨立 的 runner 名稱,ledger 拒絕同名只是防護。 - ADR-0006:派發時是保守估計,JobStarted 之後依 JIT runner 名稱歸屬實際 job; README 補上保守計費、同卡 GPU 重新歸屬與空輪詢重試。 - gofmt 整理 ledger.go、ledger_test.go、listener.go。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
修正 #192:idle 的 JIT runner 佔住 admission 額度時,listener 的 message loop 停在 admission 等待,不再
GetMessage/AcquireJobs,整個 scale set 卡死。做法照 issue 2026-11-30 的設計決定:
reconcile,message loop 繼續輪詢,下一個 envelope(包含沒有 statistics 的)再試。defaultJob。GPU 用同一個最大 VRAM 宣告選卡與計費。變更
ledger:以單一 mutex 管理已知 assignment、retired job id(最近 4096 個)、每個 runner 的計費;committed 一律由持有中的 worker 加總,不用增量計數,任何事件順序都不會變成負數或殘留。Red evidence
所有 red 都在
golang:1.25.3container 內執行(go test或just coverage-go)。卡死回歸(c1):
go test -run TestRunKeepsPollingWhenAdmissionFull,未修正前:保守計費與重新歸屬(review r1):
envelope 內順序、無 statistics 重試、GPU 卡未出現在探測(review r2):
worker 結束順序(review r3):
TestLedgerOrderInsensitive的 red 只到編譯失敗(ledger型別尚不存在)。延遲的 JobStarted 與計費大小(review r4):
加強後的測試(review r5):對 HEAD 刻意做 4 種破壞,各自讓新測試失敗後還原。
charge_test.go:210: minted [a-r1] onto a card with no room測試
just checkexit 0just coverage-goexit 0,listener core 93.9%(下限 85%)go vet、go test -race ./...通過備註
Closes #192