Repository navigation
feat: pass the charged VRAM and card total to the gpu job container (#185) - #191
Merged
Merged
Conversation
Member
Author
中文說明這個 PR 完成 #185:把分到的 VRAM 和整張卡的容量傳進 gpu job 的 container。 job 拿到的環境變數
用途
流程
後續
|
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.
Summary
Pass the charged VRAM to the gpu job container so a job can self-limit (nothing enforces VRAM on these cards):
RUNNER_VRAM_GB=<charged GiB>andRUNNER_VRAM_TOTAL_GB=<card GiB>are put on the engine argv of the job container (not in the env-file).RUNNER_VRAM_GB=unknownand no card total.RUNNER_VRAM_flag is added.Closes #185
Behaviour commits
Red evidence
Behaviour 1 (b069e88): engine env for RUNNER_VRAM_GB and RUNNER_VRAM_TOTAL_GB
Test:
runner_container_run passes RUNNER_VRAM_GB and RUNNER_VRAM_TOTAL_GB as engine env (#185)in test/bats/integration/runner_container.bats.Command:
just test-integration(whole integration dir; the justfile has no per-file filter).Before the fix:
It is the only "not ok" in the run.
After the fix:
just checkexit 0, 0 "not ok":Behaviour 2 (63c652b): provisioner exports the pinned card total
Test: listener/provisioner_test.go. Design cycles 2 and 3 (unknown with no total; unset or empty gives no flag) were already green at that point, see the TDD trail.
Command:
just coverage-goBefore the fix (compile failure):
After the fix:
just checkexit 0.Behaviour 3 (3b7c571): the listener fills the request total from the admitted card
Test:
TestPinnedJobRequestCarriesAdmittedCardTotalin listener/reactive_test.go (busy 32607 MiB card at GPU 0, idle 16380 MiB card at GPU 1; a vram-gb-4 job lands on GPU 1).Command:
just coverage-go(whole Go suite, no single-test filter). Only this test failed.Before the fix:
After the fix:
just checkwas not run for this commit because only Go files changed. The CHANGELOG already had the #185 entry.Review-fix commits
gives an unknown budget and no card total (#185)andadds no RUNNER_VRAM_ flag when the budget is unset or empty (#185). Red (just test-integration):not ok 212 ... gives an unknown budget and no card total(! grep -qxF -- 'RUNNER_VRAM_TOTAL_GB=32' "${CAP}" || return 1 failed) andnot ok 213 ... adds no RUNNER_VRAM_ flag when the budget is unset or empty(no_vram_env_on_argv || return 1 failed, a total with no budget was still emitted). Green: the same run passed after the fix,just checkexit 0.TestAdmitGPUReturnsAdmittedCardTotalin listener/reactive_test.go;TestPinnedJobRequestCarriesAdmittedCardTotalstill passes.just checkexit 0,just coverage-goexit 0 (95.2%),just coverage-gateexit 0 (bash 88.0%, floor 85%).runner_container_run adds no RUNNER_VRAM_ flag when the budget is unset or empty (#185). Mutation in lib/runner-container.sh (return 0 before launching the engine when RUNNER_VRAM_GB is empty and RUNNER_VRAM_TOTAL_GB is set), run withjust test-integration. Before the fix:not ok 215 runner_container_run adds no RUNNER_VRAM_ flag when the budget is unset or empty (#185)/(in test file test/bats/integration/runner_container.bats, line 547)[ -s "${CAP}" ]' failed. The old test was not run against the mutation; it would have passed it by reasoning only (append-only capture file). The mutation was reverted before committing. After:just checkrc=0, last lineok 278 .... Finding 1 of round 2 was comments only (no test):just check` rc=0.Review
Review rounds 1 and 2 ran; all findings listed above were addressed in the review-fix commits. No open findings.
TDD trail
Local verification
Run in Docker through the justfile on the final tree (no GPU container):
just check: exit 0, 0 "not ok", last lineok 278 update.sh continues past a failing runner and reports a summary (#49).just coverage-go: exit 0, listener core 95.2% (floor 85.0%).just coverage-gate: exit 0, bash line coverage 88.0% (floor 85.0%).just checkintegration run.All issue acceptance items (job container env, unknown for an unpinned job, deploy/README.md documentation) are covered by the tests above. Nothing is left for a real-host deploy except rolling out the new listener, which is done separately by the owner.