Stuff

UoM::RCS::Talby::Danzek::SGE



Page Group

Basic Config:

Extra Stuff:

Applications:

Scripts Etc.







Minimise User Submission Errors: Server JSV

From the SGE documenation: if jsv_url is set, then jsv_allowed_mod comes into play:

 cluster configuration parameters:

 jsv_allowed_mod 

 if there is a server JSV script defined with jsv_url parameter, then all qalter(1) or qmon(1) modification requests for jobs are rejected by the master daemon. With the jsv_allowed_mod parameter, an administrator has the possibility to allow a set of switches which can then be used with clients to
modify certain job attributes.


 -- so e.g., 
        qalter -l short <jobid> 
    will fail by default --- simply add "l_hard" via the config gui.

Extras?

 -- put "-l" stuff into job ENV (e.g., in QSUB_OPTS or HRL --- hard resource list)

 -- see 
        http://manpages.ubuntu.com/manpages/natty/man3/jsv_script_interface.3.html
    specifically
        jsv_add_env(variable_name, variable_value);

1. 

What We Have

Correct at 2012 May 29:

#!/bin/bash

jsv_on_start() {
    return
  }

jsv_on_verify() {


# ------------------------------------------------------------------------------
# -- check some hard resource request combos:

   l_inter_requested=$(jsv_sub_is_param l_hard interactive)
   l_short_requested=$(jsv_sub_is_param l_hard short)
   l_twoday_requested=$(jsv_sub_is_param l_hard twoday)

#   if [ "$l_inter_requested" = "true" ] && [ "$l_twoday_requested" = "true" ]; then
#           jsv_reject "Please specify only one of \"inter\" and \"twoday\" --- your job has been rejected"
#           return
#   fi

#   if [ "$l_inter_requested" = "true" ] && [ "$l_short_requested" = "true" ]; then
#           jsv_reject "Please specify only one of \"inter\" and \"short\" --- your job has been rejected"
#           return
#   fi

   if [ "$l_twoday_requested" = "true" ] && [ "$l_short_requested" = "true" ]; then
           jsv_reject "Please specify only one of \"twoday\" and \"short\" --- your job has been rejected"
           return
   fi


# ------------------------------------------------------------------------------
# -- interactive stuff:

   q_M610x_GPU_interactive_requested=$(jsv_sub_is_param q_hard M610x-GPU-interactive.q)
   q_C6100_GPU_interactive_requested=$(jsv_sub_is_param q_hard C6100-GPU-interactive.q)

   if [ "$q_M610x_GPU_interactive_requested" = "true" ] && [ "$l_inter_requested" != "true" ]; then
           jsv_reject "For interactive (qrsh) GPU jobs, please specify \"-l inter -l nvidia\".  There is no need to specify a queue.  Your job has been rejected"
           return
   fi

   if [ "$q_C6100_GPU_interactive_requested" = "true" ] && [ "$l_inter_requested" != "true" ]; then
           jsv_reject "For interactive (qrsh) GPU (IB-connected) jobs, please specify \"-l inter -l nvidia_ib\".  There is no need to specify a queue.  Your job has been rejected"
           return
   fi


# ------------------------------------------------------------------------------
# -- check some hard resource/queue combos:

   q_C6100_STD_serial_requested=$(jsv_sub_is_param q_hard C6100-STD-serial.q)
   q_C6100_STD_twoday_requested=$(jsv_sub_is_param q_hard C6100-STD-twoday.q)
   q_C6100_STD_short_requested=$(jsv_sub_is_param q_hard C6100-STD-short.q)
   q_R410_twoday_requested=$(jsv_sub_is_param q_hard R410-twoday.q)
   q_R410_short_requested=$(jsv_sub_is_param q_hard R410-short.q)

   if [ "$q_C6100_STD_serial_requested" = "true" ] && [ "$l_short_requested" = "true" ]; then
           jsv_reject "Please specify only one of \"C6100-STD-serial.q\" and \"short\" --- your job has been rejected"
           return
   fi

   if [ "$q_C6100_STD_serial_requested" = "true" ] && [ "$l_twoday_requested" = "true" ]; then
           jsv_reject "Please specify only one of \"C6100-STD-serial.q\" and \"twoday\" --- your job has been rejected"
           return
   fi

   if [ "$q_R410_twoday_requested" = "true" ] && [ "$l_short_requested" = "true" ]; then
           jsv_reject "Please specify \"R410-twoday.q\" only if \"-l twoday\" is also set --- your job has been rejected"
           return
   fi

   if [ "$q_R410_short_requested" = "true" ] && [ "$l_twoday_requested" = "true" ]; then
           jsv_reject "Please specify \"R410-short.q\" only if \"-l short\" is also set --- your job has been rejected"
           return
   fi

   if [ "$q_R410_twoday_requested" = "true" ] && [ "$l_twoday_requested" != "true" ]; then
           jsv_reject "Please specify \"R410-twoday.q\" only if \"-l twoday\" is also set --- your job has been rejected"
           return
   fi

   if [ "$q_R410_short_requested" = "true" ] && [ "$l_short_requested" != "true" ]; then
           jsv_reject "Please specify \"R410-short.q\" only if \"-l short\" is also set --- your job has been rejected"
           return
   fi


# ------------------------------------------------------------------------------

    pe=$(jsv_get_param pe_name)

    case "$pe" in
        orte-12.pe | orte-12-ib.pe )
            slots_min=`jsv_get_param pe_min`
##          jsv_log_warning "Example: slots=$slots_min//"
            i=`echo "$slots_min % 12" | bc`

            if [ $i -gt 0 ]; then
                jsv_reject "Parallel job PE with orte-12(-ib).pe:  number of processes must be a multiple of 12 slots"
                return
            fi
        ;;
        orte-32-ib.pe )
            slots_min=`jsv_get_param pe_min`
            slots_max=`jsv_get_param pe_max`
                # ...in case where a fixed, single figure is specced, not a range, both pe_min and pe_max are set to that single figure...

            jsv_log_warning "Example: slots_min=$slots_min//slots_max=$slots_max//"

            if [ $slots_min -gt 129 ]; then
                jsv_reject "Parallel job PE with orte-32-ib.pe:  number of processes must <= 128"
                return
            fi

            if [ $slots_max -gt 129 ]; then
                jsv_reject "Parallel job PE with orte-32-ib.pe:  number of processes must <= 128"
                return
            fi

            i=`echo "$slots_min % 32" | bc`

            if [ $i -gt 0 ]; then
                jsv_reject "Parallel job PE with orte-32-ib.pe:  number of processes must be a multiple of 32 slots"
                return
            fi
        ;;
    esac


# ------------------------------------------------------------------------------

     
#     command=$(jsv_get_param CMDNAME)
#     jsv_log_warning "CMDNAME: //$command//"
#
#     workdir=$(jsv_get_param workdir)
#     jsv_log_warning "WD: //$workdir//"
#
#     workdir=$(jsv_get_param sge_o_workdir)
#     jsv_log_warning "WD: //$workdir//"
#
#    if [ `cat $command | egrep -c "abaqus|abq6101"` -gt 0 ]; then 
#        if [ `cat $command | egrep -c "interactive"` -eq 0 ]; then 
#            jsv_reject "Abaqus jobs must be interactive!"
#            return
#        fi
#    fi


# ------------------------------------------------------------------------------

########    jsv_add_env "JSV_EXAMPLE" "jsv_value_33"


# ------------------------------------------------------------------------------

#    jsv_log_warning "Example JSV script warning."
#    jsv_log_warning "Example JSV script warning: $pe//."
#    jsv_log_info "Example JSV script info."

    jsv_accept "Job OK"
    return
  }

. ${SGE_ROOT}/util/resources/jsv/jsv_include.sh

jsv_main