I am attempting to submit multiple jobs using a job array where I pass $SLURM_ARRAY_TASK_ID to Python's argparse, but $SLURM_ARRAY_TASK_ID does not print or produce the job files expected.
Here is the batch script that I am submitting:
#!/bin/bash
#SBATCH --time=01:59:00
#SBACTH --array=1-2
#SBATCH --job-name=job_array
#SBATCH --output=log/job-%A-%a.out
#SBATCH --error=log/job-%A-%a.err
#SBACTH --array=1
echo 'Running code'
echo "Starting task" $SLURM_ARRAY_TASK_ID
python -u parse_test.py --var $SLURM_ARRAY_TASK_ID
echo 'Code done.'
The output of this job is:
Running code
Starting task
Code done.
With only one out and err file.
And I get an argparse error for no value passed for "var."
What I expect to get is:
Running code
Starting task 1
Starting task 2
Code done.
Along with two out and err files formatted job-###-$SLURM_ARRAY_TASK_ID.out(err) with the output(errors) from my python code.
I've searched the documentation for job arrays and I don't see what could be wrong here. Any help is much appreciated.