Honor the slurm limit for maximum array job size (`MaxArraySize`), by splitting up larger job batches into multiple smaller array jobs.
Honor the slurm limit for the maximum number of jobs which are allowed to be submitted by a user at the same time (`MaxSubmitJobsPerUser`) by looking up the number of currently submitted jobs and only submitting new batches once they fit within the limit.
The slurm command used to look up `MaxArraySize` is `scontrol show config | sed -n '/^MaxArraySize/s/.*= *//p'`.
The slurm command used to look up `MaxSubmitJobsPerUser` is `sacctmgr list -n user $USER withassoc format=maxsubmitjobsperuser` and if not defined `sacctmgr list -n qos normal format=maxsubmitjobsperuser`.
The slurm command used to look up the number of currently submitted jobs is `squeue --array -u $USER -h | wc -l`.