Add inherit_env and login_shell submit options#4
Merged
Conversation
By default jobs inherit the submitting process's full environment (Popen os.environ merge locally; bsub's environment copy on LSF), which leaks whatever the submitter has set. The new kwargs let callers construct the job environment instead: - inherit_env=False: local jobs get a minimal baseline (identity vars + fixed PATH) plus explicit env; LSF submits with `-env none`, and any explicit env vars move into the script as exports since bsub will no longer copy them. - login_shell=True: run under a login shell (`bash -l` locally, `bsub -L /bin/bash` on LSF) so the target user's own profile builds PATH/modules/conda, as an SSH session would. Defaults preserve existing behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 task
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
Popenmergesos.environlocally;bsubcopies the caller's environment on LSF), which leaks whatever the submitter happened to have set (e.g.PIXI_PROJECT_MANIFEST, worker-internal vars). Two newsubmit()kwargs let callers construct the job's environment instead of inheriting it:inherit_env=False— local jobs get a minimal baseline (identity vars + fixedPATH) plus any explicitenv; LSF submits with-env none, and explicit env vars move into the script as exports sincebsubwill no longer copy them.login_shell=True— run under a login shell (bash -llocally,bsub -L /bin/bashon LSF) so the target user's own profile buildsPATH/modules/conda, as an SSH session would.inherit_env=True,login_shell=False) preserve existing behavior — this is purely additive.Stacked on #3 (
fix-cross-user-polling) since that's what it was branched from; the diff here is only the new commit.Why
fileglancer's cluster-job launcher needs to stop leaking its own process environment into every submitted job. This library needs the explicit
inherit_env/login_shellcontrols before fileglancer's PR can be un-blocked and released against.Test plan
pixi run test— 162 passed (new coverage intests/test_local.pyandtests/test_lsf.py)@StephanPreibisch @JaneliaSciComp/fileglancer