Skip to content

Commit 24cb4a7

Browse files
committed
Ensure the env of sbatch is clean
1 parent f54d1a5 commit 24cb4a7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

varipeps/utils/slurm.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,16 @@ def get_own_job_data(cls):
100100

101101
@staticmethod
102102
def run_slurm_script(path, cwd=None):
103-
cwd = pathlib.Path(cwd).resolve()
103+
cwd = pathlib.Path(cwd).absolute()
104+
105+
prog_env = {
106+
k: v
107+
for k, v in os.environ.items()
108+
if not (k.startswith("SBATCH_") or k.startswith("SLURM_"))
109+
}
104110

105111
p = subprocess.run(
106-
["sbatch", str(path)], capture_output=True, text=True, cwd=cwd
112+
["sbatch", str(path)], capture_output=True, text=True, cwd=cwd, env=prog_env
107113
)
108114

109115
if p.returncode != 0:

0 commit comments

Comments
 (0)