Read a slurm batch file and capture the SBATCH options

read_sbatch(x)

Arguments

x

Character scalar. Either the path to the batch file to process, or a character vector.

Value

A named vector of the options starting with #SBATCH in the file. If no option is found, then returns a character vector length 0.

Examples


# Reading in an example script
x <- system.file("example.slurm", package="slurmR")
read_sbatch(x)
#>             job-name               output                array 
#>       "NameOfTheJob"        "logfile.out"              "1-100" 
#>               ntasks            partition 
#>                  "1" "NameOfThePartition"