From 9c580d7bbe274a79d523a679b1065d7d12eadb5f Mon Sep 17 00:00:00 2001 From: Jaime Frey Date: Fri, 4 Jun 2021 09:15:47 -0500 Subject: [PATCH] Make BatchExtraSubmitArgs more flexible. HTCONDOR-526 If BatchExtraSubmitArgs doesn't begin with the batch system's prefix (e.g. '#SBATCH'), insert it when writing the submit script. --- src/scripts/blah_common_submit_functions.sh | 6 +++++- src/scripts/lsf_submit.sh | 2 ++ src/scripts/pbs_submit.sh | 2 ++ src/scripts/sge_submit.sh | 2 ++ src/scripts/slurm_submit.sh | 2 ++ 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/scripts/blah_common_submit_functions.sh b/src/scripts/blah_common_submit_functions.sh index f5bc051c..c1fe6051 100755 --- a/src/scripts/blah_common_submit_functions.sh +++ b/src/scripts/blah_common_submit_functions.sh @@ -842,7 +842,11 @@ function bls_set_up_local_and_extra_args () fi if [ ! -z "$bls_opt_xtra_args" ] ; then - echo -e $bls_opt_xtra_args >> $bls_tmp_file 2> /dev/null + prefix= + if echo "$bls_opt_xtra_args" | grep -q -v "^$bls_submit_args_prefix" ; then + prefix="$bls_submit_args_prefix " + fi + echo -e ${prefix}${bls_opt_xtra_args} >> $bls_tmp_file 2> /dev/null fi } diff --git a/src/scripts/lsf_submit.sh b/src/scripts/lsf_submit.sh index a0f3d998..4388e8a3 100755 --- a/src/scripts/lsf_submit.sh +++ b/src/scripts/lsf_submit.sh @@ -47,6 +47,8 @@ . `dirname $0`/blah_common_submit_functions.sh +bls_submit_args_prefix="#BSUB" + conffile=$lsf_confpath/lsf.conf lsf_base_path=`cat $conffile|grep LSB_SHAREDIR| awk -F"=" '{ print $2 }'` diff --git a/src/scripts/pbs_submit.sh b/src/scripts/pbs_submit.sh index e386ed33..4a2df7f3 100755 --- a/src/scripts/pbs_submit.sh +++ b/src/scripts/pbs_submit.sh @@ -44,6 +44,8 @@ . `dirname $0`/blah_common_submit_functions.sh +bls_submit_args_prefix="#PBS" + logpath=${pbs_spoolpath}/server_logs if [ ! -d $logpath -o ! -x $logpath ]; then if [ -x "${pbs_binpath}/tracejob" ]; then diff --git a/src/scripts/sge_submit.sh b/src/scripts/sge_submit.sh index 49812b1e..32696e29 100755 --- a/src/scripts/sge_submit.sh +++ b/src/scripts/sge_submit.sh @@ -36,6 +36,8 @@ . `dirname $0`/blah_common_submit_functions.sh +bls_submit_args_prefix='#$' + if [ -z "$sge_rootpath" ]; then sge_rootpath="/usr/local/sge/pro"; fi if [ -r "$sge_rootpath/${sge_cellname:-default}/common/settings.sh" ] then diff --git a/src/scripts/slurm_submit.sh b/src/scripts/slurm_submit.sh index 054b36b8..5a5c523d 100755 --- a/src/scripts/slurm_submit.sh +++ b/src/scripts/slurm_submit.sh @@ -32,6 +32,8 @@ slurm_std_storage=${slurm_std_storage:-/dev/null} slurm_binpath=${slurm_binpath:-/usr/bin} +bls_submit_args_prefix="#SBATCH" + bls_parse_submit_options "$@" bls_setup_all_files