[slurm-users] --partition requests ignored in scripts

Michael Gutteridge michael.gutteridge at gmail.com
Thu Nov 9 16:43:29 UTC 2023

The position of the #SBATCH directives also matters (emphasis mine):

> The batch script may contain options preceded with "#SBATCH" *before any
executable commands* in the script.

We've been bit by that a couple times- a stray command before any #SBATCH
lines will cause any of those directives to be ignored.

 - Michael

On Wed, Nov 8, 2023 at 11:41 PM Bjørn-Helge Mevik <b.h.mevik at usit.uio.no>

> "Bunis, Dan" <Daniel.Bunis at ucsf.edu> writes:
> > My colleagues and I have noticed that our compute cluster seems to
> > ignore '--partition' requests when we give them as '#SBATCH
> > --partition=<partition_name>' inside of our scripts, but it respects
> > them when given in-line within our sbatch calls as 'sbatch
> > --partition=<partition_name> script.sh'.  Based on some googling, it
> > seems that both methods are meant to work, so I'm wondering if it's
> > known what can cause the in-script methodology to NOT work for
> > schedulers where the in-line methodology DOES work?
> My suspicion is that there is an environment variable SBATCH_PARTITION
> set in your shells.  Such a variable will override the #SBATCH directive,
> but not the command line switch.
> From man sbatch:
> [...]
>     NOTE: Environment variables will override any options set in a batch
>     script, and command line options will override any environment
>     variables.
> --
> Regards,
> Bjørn-Helge Mevik, dr. scient,
> Department for Research Computing, University of Oslo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20231109/4d1b5b73/attachment.htm>

More information about the slurm-users mailing list