Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:34

0001 #!/bin/bash
0002 
0003 #----------------------------------------------------------------------------------------------------
0004 
0005 # set defaults
0006 test_only="y"
0007 use_lxbatch="n"
0008 queue="1nd"
0009 
0010 #----------------------------------------------------------------------------------------------------
0011 
0012 function PrintUsage()
0013 {
0014         echo "USAGE: submit <options> [config]"
0015         echo "OPTIONS:"
0016         echo "    -test             prepare jobs but do not execute"
0017         echo "    -run              prepare jobs and execute"
0018         echo "    -local            execute jobs locally"
0019         echo "    -batch, -lxbatch  submit jobs to LXBATCH"
0020         echo "    -submit           abbreviation of -run and -batch"
0021         echo "    -queue <q>        use LXBATCH queue <q>, implies -batch option"
0022 }
0023 
0024 #----------------------------------------------------------------------------------------------------
0025 
0026 # load code
0027 source "tb_code"
0028 
0029 #----------------------------------------------------------------------------------------------------
0030 # parse command line
0031 
0032 while [ -n "$1" ]
0033 do
0034         case "$1" in
0035                 "-h" | "--help")
0036                         PrintUsage
0037                         exit 0
0038                         ;;
0039 
0040                 "-test")
0041                         test_only="y"
0042                         ;;
0043 
0044                 "-run")
0045                         test_only="n"
0046                         ;;
0047 
0048                 "-local")
0049                         use_lxbatch="n"
0050                         ;;
0051 
0052                 "-batch" | "-lxbatch")
0053                         use_lxbatch="y"
0054                         ;;
0055 
0056                 "-queue")
0057                         shift
0058                         queue="$1"
0059                         use_lxbatch="y"
0060                         ;;
0061 
0062                 "-submit")
0063                         test_only="n"
0064                         use_lxbatch="y"
0065                         ;;
0066 
0067                 -*)
0068                         echo "ERROR: unknown option '$1'."
0069                         PrintUsage
0070                         exit 1
0071                         ;;
0072 
0073                 *)
0074                         if [ -n "$input_config" ]
0075                         then
0076                                 echo "ERROR: only one config can be used at at time."
0077                                 exit 1
0078                         fi
0079                         input_config="$1"
0080                         ;;
0081 
0082         esac
0083 
0084         shift
0085 done
0086 
0087 #----------------------------------------------------------------------------------------------------
0088 # source config
0089 
0090 if [ ! -f "$input_config" ]
0091 then
0092         echo "ERROR: can't read config file '$input_config'."
0093         PrintUsage
0094         exit 1
0095 fi
0096 
0097 source "$input_config"