How can I programmatically access SLURM environmental variables, like MaxArraySize or MaxJobCount? I would like to partition my job arrays into chunks of the allowed maximum size. Can this information be queried with any of SLURM's commands? So far, I have failed to find relevant information on this over the net. Finding slurm.conf on each machine and extract the relevant line from it is not a very robust solution.

$ scontrol show config | grep -E 'MaxArraySize|MaxJobCount'
MaxArraySize            = 1001
MaxJobCount             = 1000000

Will that be enough for what you're wanting to do?

To get only the value for e.g. MaxArraySize:

$ scontrol show config | sed -n '/^MaxArraySize/s/.*= *//p'

As a shell function:

slurm_conf_value () {
    scontrol show config | sed -n "/^$1/s/.*= *//p"

MaxArraySize="$(slurm_conf_value 'MaxArraySize')"

These are not environment variables in the Unix sense, but configuration settings in Slurm. They are variables for configuring the "Slurm environment" though.

  • Ok, I was desperately searching for scontrol show config or similar in the docs, but obviously I overlooked it. Thanks, this will do perfectly! – István Zachar May 12 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.