I'm trying to pass the index of a job in a job array as a parameter to another bash script.
numSims=3
numTreatments=6 # uses numTreatments top rows of parameters.csv
maxFail=10
j=1
while [ $j -le $numSims ];
do
bsub -q someQueue -J "mySim[1-$numTreatments]%2" ./another_script.sh $LSB_JOBINDEX $j $maxFail
let j=j+1
done
The ultimate idea here is to submit, for each of 1,...,numTreatments
,numSims
jobs (simulations). I'd like two jobs running at a time (%2
). Outputs have the form XX_indexNumber_simNumber, where indexNumber runs from 1,...,numTreatments
and simNumber from 1,...,numSims
.
Ideally, everything submitted as part of this script would have the same job ID. This isn't yet set up correctly, because all jobs with the same j
are being assigned a distinct job ID. My immediate problem is that another_script.sh is not recognizing $LSB_JOBINDEX
as input--it sees $j
and $maxFail
as the first and only two passed parameters. When I put some other variable in place of $LSB_JOBINDEX
, there's no problem. What am I doing wrong?
Edit - some things I've tried: "$LSB_JOBINDEX"
, ${LSB_JOBINDEX}
, %I
, and I=$LSB_JOBINDEX; bsub ... $I $j $maxFail