Use the correct python version when running jobs #620
Merged
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.
In local dev environments, we run with
just
, which explicitlyuses the virtual env bin to run all commands, without the
user needing to manually activate it. However, dispatcher jobs are
run in a subprocess and just run with
python ...
and so don'tautomatically use the virtualenv python.
In the Dockerfile (i.e. for production), we prepend the virtualenv
bin path to the PATH environment variable, which ensures that the
virtualenv python will be the first python encountered and used.
We now check for an ABSOLUTE_BIN env variable (set in the justfile, so this
will only apply for local envs, not prod) and ensure that it is first
in the PATH when running a job.
Note that we could set PATH itself in the justfile so that it is passed
through in os.environ to the job subprocess, but if we do,
it'll set the user's global PATH, which is not necessarily what they
want.