Am 18.12.2012 um 17:25 schrieb [email protected]:

> In the message dated: Tue, 18 Dec 2012 11:24:22 +0100,
> The pithy ruminations from Reuti on 
> <Re: [gridengine users] JSV unexpectedly alters resource request from boolean 
> t
> o float> were:
> => Am 17.12.2012 um 09:19 schrieb William Hay:
> => 
> => > On 14 December 2012 22:30, [email protected] <[email protected]> 
> wrote:
> => > 
>       [SNIP!]
> 
> => > 
> => > The JSV consists of:
> => > 
> => > #############################
> => > #!/bin/sh
> => > # from
> => > #   
> http://www.mentby.com/Group/grid-engine/default-resource-per-queue.html
> => > 
> => > # JSV to convert PE names to wildcard version, in order to allow users 
> to submit jobs
> => > # with:
> => > #   -l pe openmpi
> => > # and have it transparently refer to
> => > #   -l pe openmpi-Intel*
> => > # or
> => > #   -l pe openmpi-AMD*
> => > 
> => > jsv_on_start() {
> => >       return
> => > }
> => > 
> => > jsv_on_verify() {
> => >       pe=$(jsv_get_param pe_name)
> => >       case "$pe" in
> => >           openmpi )
> => >             jsv_set_param pe_name "$pe-*"
> => >             jsv_sub_add_param l_hard openmpi TRUE   # in case it wasn't 
> set already
> => >             jsv_correct "Job was modified"
> => >             ;;
> => >       esac
> => >       jsv_accept "Job OK"
> => 
> => You should call either jsv_correct or jsv_accept, but not both (which 
> can/will happen in the abo
> => ve case). Please have a look at the example in 
> $SGE_ROOT/util/resources/jsv/jsv.sh where it's do
> 
> Thanks for the reminder to check the example script.
> 
> => ne by setting some flags.
> 
> 
> Hmmm.... I guess I'm mis-reading the jsv_script_interface(3) man
> page. Where it says:
> 
>   jsv_accept()
>       This  function can only be used in jsv_on_verify(). After it
>       has been called, the function jsv_on_verify() has to return
>       immediately.
> 
> [SNIP!]
> 
>   jsv_correct()
>       This  function can only be used in jsv_on_verify(). After it
>       has been called, the function jsv_on_verify() has to return
>       immediately.
> 
> I interperted it as meaning that there was an implicit "exit" in both
> jsv_accept and jsv_correct, meaning that the execution flow inside
> jsv_on_verify would end after either of those statements, and it could
> not continue after calling jsv_correct into jsv_accept.
> 
> It sounds like you're saying I could do something like:
> 
>       ######################################################
>       jsv_on_verify() {
>               pe=$(jsv_get_param pe_name)
>               case "$pe" in
>                       openmpi )
>                               jsv_set_param pe_name "$pe-*"
>                               jsv_correct "Job was modified"
>                               return
>                               ;;
>               esac
> 
>               jsv_accept "Job OK"
>       }
>       ######################################################
> 
> or 
> 
>       ######################################################
>       jsvmsg="Job OK"
>       jsv_on_verify() {
>               pe=$(jsv_get_param pe_name)
>               case "$pe" in
>                       openmpi )
>                               jsv_set_param pe_name "$pe-*"
>                               jsvmsg="Job was modified"
>                               return
>                               ;;
>               esac
>               
>               # call jsv_correct, even if no correction is done,
>               # as jsv_accept ignores all modifications

if [ -n "$jsvmsg" ]; then
    jsv_correct $jsvmsg
else
    jsv_accept
fi


>               jsv_correct $jsvmsg
>       }
>       ######################################################

Exactly.

Having several tests in the script makes it more advantageous to set a flag and 
handling it at the end of the procedure.

If you check the jsv_include.sh in the directory I mentioned: jsv_correct resp. 
jsv_accept will send a message to SGE and will return to your script.

-- Reuti


> => 
> => -- Reuti
> => 
> 
> Thanks,
> 
> Mark


_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to