在LSF作业数组中引用作业索引 [英] Referencing job index in LSF job array
问题描述
我正在尝试将作业数组中的作业索引作为参数传递给另一个bash脚本.
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
这里的最终想法是为1,...,numTreatments
,numSims
个作业(模拟)中的每一个提交一个.我想一次运行两个作业(%2
).输出格式为XX_indexNumber_simNumber,其中indexNumber从1,...,numTreatments
开始,simNumber从1,...,numSims
开始.
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
.
理想情况下,作为该脚本的一部分提交的所有内容都将具有相同的作业ID.这尚未正确设置,因为所有具有相同j
的作业都被分配了不同的作业ID. 我眼前的问题是another_script.sh无法将$LSB_JOBINDEX
识别为输入-它将$j
和$maxFail
视为第一个且只有两个传递的参数. $LSB_JOBINDEX
的位置,没有问题.我在做什么错了?
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?
编辑-我尝试过的一些操作:"$LSB_JOBINDEX"
,${LSB_JOBINDEX}
,%I
和I=$LSB_JOBINDEX; bsub ... $I $j $maxFail
Edit - some things I've tried: "$LSB_JOBINDEX"
, ${LSB_JOBINDEX}
, %I
, and I=$LSB_JOBINDEX; bsub ... $I $j $maxFail
推荐答案
来自此链接:
上面的定义将不仅启动一个批处理作业,还将启动100个批处理作业,其中子作业特定的环境变量$ LSB_JOBINDEX从1到100取值.然后可以在实际的作业启动命令中利用此变量,以便每个子任务都可以已处理.
The definition above will launch not just one batch job, but 100 batch jobs where the subjob specific environment variable $LSB_JOBINDEX gets values form 1 to 100. This variable can then be utilized in the actual job launching commands so that each subtask gets processed.
在您的情况下,这意味着变量$LSB_JOBINDEX
在脚本another_script.sh
中可用.您无需将其作为参数传递,而只需在脚本中访问$LSB_JOBINDEX
.
In your case, this means that the variable $LSB_JOBINDEX
is available from inside the script another_script.sh
. You do not need to pass it as a parameter, but just access $LSB_JOBINDEX
in your script.
这篇关于在LSF作业数组中引用作业索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!