最终对我有用的是提出的解决方案(1)。在这里,我将讨论我是如何在我的 condor 提交文件和我的 worker shell 脚本中实现 (1) 的。
这是shell脚本。重要的变化是通过以下方式检查 R 是否安装在计算节点上:if [ -f /usr/bin/R ]
. 如果找到 R,我们沿着返回值 0 结束的路径前进。如果没有找到 R,我们返回 1(这就是行exit 0
和的含义exit 1
)。
mkdir output
if [ -f /usr/bin/R ]
then
if $(uname -m |grep '64')
then
Rscript code/simulations-x86_64.r $*
else
Rscript code/simulations-i386.r $*
fi
tar -zcvf output/output-$1-$2.tgz2 output/*.csv
exit 0
else
exit 1
fi
现在神鹰提交文件。关键的变化是倒数第二行 ( on_exit_remove = (ExitBySignal == False) && (ExitCode == 0)
)。它检查来自计算节点的每个作业的返回值——如果返回值不为零(即,如果在计算节点上未找到 R),则将作业放回队列中以重新运行。否则,作业被认为已完成并从队列中删除。
universe = vanilla
log = logs/log_$(Cluster)_$(Process).log
error = logs/err_$(Cluster)_$(Process).err
output = logs/out_$(Cluster)_$(Process).out
executable = condor/worker.sh
arguments = $(Cluster) $(Process)
requirements = (Target.OpSys=="LINUX" && regexp("stat", Machine))
should_transfer_files = YES
when_to_transfer_output = ON_EXIT_OR_EVICT
transfer_input_files = code, R-libs, condor, seeds.csv
transfer_output_files = output
notification = Never
on_exit_remove = (ExitBySignal == False) && (ExitCode == 0)
queue 1800