Place code snapshots outside the repo when save_dir is in-repo#522
Open
eugenevinitsky wants to merge 2 commits into
Open
Place code snapshots outside the repo when save_dir is in-repo#522eugenevinitsky wants to merge 2 commits into
eugenevinitsky wants to merge 2 commits into
Conversation
isolate_code() planted save_dir/code snapshots (pufferlib copy plus a symlink farm to every top-level repo entry) inside the source tree when save_dir was in-repo. setuptools file discovery walks the whole tree following symlinks, so pip install -e . traversed every snapshot, and snapshots under different in-repo save roots symlinked each other into genuine cycles, making builds effectively endless. In-repo save dirs now get their snapshot in a <repo>_code_snapshots/ sibling directory that mirrors save_dir's relative layout; out-of-repo save dirs keep the old save_dir/code location. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
isolate_code()inscripts/submit_cluster.pynow checks whether the resolvedsave_dirlives inside the resolved project root. If it does, the code snapshot is placed in a sibling directory next to the repo —<repo>_code_snapshots/<save_dir relative path>/code— instead ofsave_dir/codeinside the source tree. Out-of-repo save dirs keep the existingsave_dir/codelocation. Thecode_vNversioning, symlink farm,pufferlib/copy, and the return value threading into the job'sproject_rootare all unchanged.Why
With an in-repo save dir (the common
--save_dir experiments), every submission planted a fullpufferlib/copy plus a symlink farm pointing at every top-level repo entry inside the source tree. setuptools egg_info/manifest processing walks the entire tree withos.walk(followlinks=True)(theMANIFEST.inglobal-include forces the walk; excludes only apply afterwards), sopip install -e .traversed every snapshot'spufferlibcopy and chased the symlink farms. Snapshots under two different in-repo save roots symlink each other and form genuine cycles, making editable installs effectively endless — and worse with every submission. Keeping snapshots outside the tree removes them from setuptools file discovery entirely.Notes
py_compilepasses;isolate_codewas unit-exercised via importlib against fake repo trees — in-repo save_dir lands the snapshot in the<repo>_code_snapshotssibling (with correct copy/symlink structure and workingcode_vNversioning), out-of-repo save_dir keepssave_dir/code. Grep confirms the single call site (line ~459) needs no change. A real cluster submission was not run.save_dir/codefor such runs must look in the sibling dir (the submit-time>>> Code snapshot:log prints the actual path). The sibling dir requires write access next to the repo — true for the/scratch/$USER/code/cluster layout.🤖 Generated with Claude Code
🤖 Generated with Claude Code