LSF 有一个商业化的产品叫做 LSF License Scheduler,可以用于配合 License,避免提交到服务器因为缺少 License 无法跑起来(无剩余 License 的时候,最好是让 Job 继续排队)。
比如我们有个脚本叫 elim.hspice
#!/bin/bash
#This script runs only on LSF Master Node
lsf_master_host=`lsid|grep master|awk '{print $5}'`
hostname=`echo $HOSTNAME`
if [ $hostname != $lsf_master_host ]
then
exit
fi
# Master Node validation completed
whiletrue;do
# add the features in the follow format
# feature_name,license-port@server-host-name,printable_license_name
license_details=("hspice,port@license1,hspice_lic" "hsim,port@server2,hsim_lic")
# Stop editing from here.
outstring=""
for lic in ${license_details[@]}
do
feature=`echo $lic|awk -F, '{print $1}'`
server=`echo $lic|awk -F, '{print $2}'`
lic_name=`echo $lic|awk -F, '{print $3}'`
availability=`lmstat -c $server -f $feature|grep $feature|awk '{print $6 – $11}'`
# Return zero if license server is down
if [ -z $availability ];then
availability=0
fi
outstring="$outstring$lic_name$availability"
done
echo ${#license_details[@]}$outstring
sleep 60
done以上方式,通过 elim 的方式,查询还有多少 License 剩余,然后 LSF 提交任务的时候,我们指定这个 elim 资源需求就可以。 提交 Job 的时候指定:
$bsub -R "rusage[hspice > 1]" hspicejob.sh


网友留言: