On 19 July 2011 16:43, Reuti <[email protected]> wrote:
> Okay, a:
>
> set -a
>
> before the sourcing would have done it too.
>
> -- Reuti
>
> ===
>
> Am 19.07.2011 um 17:12 schrieb William Hay:
>
>> On 19 July 2011 15:15, Reuti <[email protected]> wrote:
>>> Hi,
>>>
>>> Am 19.07.2011 um 16:02 schrieb William Hay:
>>>
>>>> I'm trying to configure Grid Engine for interactive jobs but the
>>>> environment variables provided by Grid Engine for batch jobs don't
>>>> seem to be
>>>> available to interactive jobs.  This means, for instance, that I can't
>>>> find $TMPDIR or the machines file for parallel interactive jobs except
>>>> by poking around.   I'm using the qlogin command with qlogin_command
>>>> and qlogin_daemon set to builtin although I've tried ssh based
>>>> versions as well.
>>>>
>>>> I've checked for the value of JOB_NAME which the man page explicitly
>>>> says is set for qlogin but it doesn't show up.
>>>> Using SGE 6.2u3 on Scientific Linux 5 (RHEL/CentOS clone).   Launching
>>>> a new login shell with bash -l doesn't seem to
>>>> clean out the environment so I assume it is something that sshd and
>>>> SGE's builtin rsh server do.
>>>
>>> correct. You get a clean new shell. To make all the environemt variables 
>>> available in the job, you can use this in your ~/.profile:
>>>
>>> MYPARENT=`ps -p $$ -o ppid --no-header`
>>> #MYPARENT=`ps -p $MYPARENT -o ppid --no-header`
>>> #MYPARENT=`ps -p $MYPARENT -o ppid --no-header`
>>> MYSTARTUP=`ps -p $MYPARENT -o command --no-header`
>>>
>>> if [ "${MYSTARTUP:0:13}" = "sge_shepherd-" ]; then
>>>  echo "Running inside SGE"
>>>  MYJOBID=${MYSTARTUP:13}
>>>  MYJOBID=${MYJOBID% -bg}
>>>  echo "Job $MYJOBID"
>>>
>>>  . /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment
>>>  unset HISTFILE
>>> fi
>>>
>>>
>>> The above is for SGE's built-in mechanism, you have to uncomment the two 
>>> statements if you use ssh. Also the path the node's spool directory needs 
>>> to be adjusted.
>>>
>>> -- Reuti
>>>
>>>
>>>
>>>
>> Thanks for that.  As I'm trying to get an environment as close as
>> possible to the batch environment I assume I'll need to export all the
>> standard SGE variables after
>> sourcing that file to turn them into proper environment variables
>> rather than just shell variables.
>
> Correct, it could be improved like:
>
> while read LINE; do export $LINE; done < 
> /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment
>
> instead of plain sourcing.
>
> -- Reuti

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

Reply via email to