10

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.

István Zachar
  • 203
  • 2
  • 6

1 Answers1

14
$ 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.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • 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