[GE users] env variables usage question

reuti reuti at staff.uni-marburg.de
Wed Dec 17 00:21:40 GMT 2008


Am 16.12.2008 um 20:13 schrieb Henry, Mark Patrick:

> Can't find a clear explanation on this in the manuals or online..  
> I'd appreciate any help.
> I'm trying to use shell env. variables in a sge script, including  
> the parameter variables ($* etc) when submitted via qsub or a qrsh  
> batch submission and its not working as I would expect, or at all  
> in fact.
> For example,
> -- submission cmd --
> qrsh -V -now -q queue1 -b n ./myscript arg1 arg2

only inside the script they are working, not for SGE #$ options

> --- myscript --
> #!/usr/bin/ksh
> # Send mail to these users
> #$ -M $LOGNAME at mailserver.local.com

This won't work,

> # Mail at beginning/end/on suspension
> #$ -m bes
> # auto-name the job based on params
> #$ -N "$LOGNAME: first: $1, second: $2"

this neither.

The $... epxansion is a feature of the shell, which will be expanded  
at runtime, neither at submit time, nor inside comments. For the -e  
and -o options to qsub you have some pseudo variables, but that's all.

> # pass on all the args to the actual build script
> build_script $*
> So, pretty simple.. I just want to pass through some parameters  
> from the user cmd submission into the script and on to the actual  
> build script later.  Also, I'd like to be able to use other vars in  
> the users environment to give a customized email message while  
> having a single script for everyone.

You will need a submission script or qsub-wrapper, which your user  
must call:

qsub -N "$LOGNAME: first: $1, second: $2" -M  
$LOGNAME at mailserver.local.com -m bes myscript $1 $2

for the above behavior.

But I would suggest to shorten the things: the submission user is  
always the one who submits the job, so the name of the job would list  
it again. Just output the parameters could be enough as the user is  
mentioned in another column in qstat.

The email is always send by default to the one submitting the job. So  
instead of putting the forward to the mail server in the -M option  
(which is possible of course), I would forward it in your  
emailserver. As the emails are sent from the nodes, and most often  
first to the head node of the cluster which has a connection to the  
outside world and the private cluster network, you will need some  
kind of set up mail rekaying anyway. In postfix it would just be one  
line in one of the config files. Let me know, if you need further  
info on this.

-- Reuti

> It seems that -V would be the mechanism to do this, but it doesn't  
> seem to fly.  Running GE v6.1
> If there are any alternate suggestions too, that'd be appreciated.
> Many thanks,
> -Mark
> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do? 
> dsForumId=38&dsMessageId=92848
> To unsubscribe from this discussion, e-mail: [users- 
> unsubscribe at gridengine.sunsource.net].


To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].

More information about the gridengine-users mailing list