Skip to content

Commit

Permalink
Fixed handling of env vars in Slurm. The existing template made some
Browse files Browse the repository at this point in the history
assumptions about how the process worked that were incorrect. Specifically,
you cannot issue multiple `#SBATCH --export` directives and expect them
to add up. Only one should be used.
  • Loading branch information
hategan committed Feb 7, 2024
1 parent 391eb6b commit 25fa212
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/psij/executors/batch/slurm/slurm.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
#SBATCH --chdir="{{.}}"
{{/job.spec.directory}}

{{#job.spec.inherit_environment}}
#SBATCH --export=ALL
{{/job.spec.inherit_environment}}
{{^job.spec.inherit_environment}}
#SBATCH --export=NONE
{{/job.spec.inherit_environment}}

{{#job.spec.resources}}
{{#exclusive_node_use}}
#SBATCH --exclusive
Expand Down Expand Up @@ -80,9 +73,17 @@ export PSIJ_NODEFILE


{{#env}}
#SBATCH --export={{name}}={{value}}
export {{name}}={{value}}
{{/env}}

{{#job.spec.inherit_environment}}
#SBATCH --export=ALL{{#env}},{{name}}{{/env}}
{{/job.spec.inherit_environment}}
{{^job.spec.inherit_environment}}
#SBATCH --export={{#env}}{{name}},{{/env}}
{{/job.spec.inherit_environment}}


{{!redirect output here instead of through #SBATCH directive since SLURM_JOB_ID is not available
when the directives are evaluated; the reason for using the job id in the first place being the
same as for the exit code file.}}
Expand Down

0 comments on commit 25fa212

Please sign in to comment.