(torchx-fb/penv)(bugfix) handle sys.argv[0] relpaths correctly when finding penv.par, add a CWD/penv.par search fallback to handle unittest @mode/opt #216
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:
Fixes the following two scenarios:
#1
Does not pick up
~/bin/penv.par
(as expected) becausesys.argv[0] = ./python
. Fix is to return(Path(sys.argv[0])/"penv.par").absolute()
#2
Using this interpreter as a unittest resource + torchx local_cwd scheduler does not resolve penv.par from the test source dir since the symlink is resolved by unix and
sys.argv[0]
is set to the actual interpreter (not the symlinked one)Hence with the current penv par lookup logic we end up looking for a penv.par in
buck-out/opt/gen/torchx/fb/penv.par
which does not exist and we just simply fall back to system python.Reviewed By: aivanou
Differential Revision: D31402466