I am currently running a slurm job file on an array that I manually set the size of, e.g.
sbatch --array=1-6 myjob.array the size of the array is determined when setting up the code to run. E.g. if I have 2 variables that both require 2 years of data running for them, across 6 scenarios, I have 24 array tasks. I get this manually and set the job running with
sbatch --array=1-24 myjob.array inside my R code i use the task number like so;
i_a <- as.numeric(commandArgs(trailingOnly = TRUE)[1]) # array number But what i really want is to be able to set the model up and just run a master job file that works out the length of array required, based on the variables i've just set in setup.R, and calls and passes that number to another job file.
E.g. I could set the multiple model variables in setup.R and the initial job file (master.job) could simply return the product of their lengths, 24 in the case above. It could pass this directly to the actual .array job file as a variable which could use it in the line #SBATCH --array=1-${n}
is that even possible?