[GRASS-dev] GRASS_BATCH_JOB and GISRCRC

Glynn Clements glynn at gclements.plus.com
Thu Aug 28 09:16:34 EDT 2008


Markus Neteler wrote:

> >> >> I would like to submit the following change to facilitate the use
> >> >> of GRASS on clusters/in parallel jobs:
> >> >>
> >> >>
> >> >> Index: lib/init/init.sh
> >> >> ===================================================================
> >> >> --- lib/init/init.sh    (revision 33097)
> >> >> +++ lib/init/init.sh    (working copy)
> >> >> @@ -159,7 +159,11 @@
> >> >>  export GIS_LOCK
> >> >>
> >> >>  # Set the global grassrc file
> >> >> -GISRCRC="$HOME/.grassrc6"
> >> >> +if [ -n "$GRASS_BATCH_JOB" ] ; then
> >> >> +       GISRCRC="$HOME/.grassrc6.`uname -n`"
> >> >> +else
> >> >> +       GISRCRC="$HOME/.grassrc6"
> >> >> +fi
> >> >>
> >> >>  # Set the session grassrc file
> >> >>  if [ "$MINGW" ] ; then
> >> >>
> ...
> > Hmm. Are you confusing $GISRCRC and $GISRC? The former is the
> > persistent ~/.grassrc6 (etc) file, the latter is the per-session copy
> > which Init.sh puts into /tmp/grass6-<user>-pid and which is actually
> > used by the programs.
> 
> Yes. I meant ~/.grassrc6. Possibly I am lagging behind for some years
> as I used GRASS 6.3.old there :). Now I am switching to GRASS 6.4 for my
> cluster calculations and have to solve this problem.
> 
> So indeed I should modify
> ## use TMPDIR if it exists, otherwise /tmp
> #tmp=${TMPDIR-/tmp}
> #tmp="$tmp/grass6-$USER-$GIS_LOCK"
> tmp=/tmp/grass6-$USER-$GIS_LOCK
> (umask 077 && mkdir "$tmp") || {
>     echo "Cannot create temporary directory! Exiting." 1>&2
>     exit 1
> }
> GISRC="$tmp/gisrc"
> export GISRC
> 
> Or no modifications needed at all? Mhh, probably I am really confusing things
> and everything just works out of the box. Will test the next days.

If the idea is to manually set up ~/.grassrc6.<hostname> files for
each host, each with a different mapset, then your original idea is
about right, but you need a fallback so that GRASS_BATCH_JOB continues
to work for everyone who only has a ~/.grassrc6 file, not multiple
~/.grassrc6.<hostname>. E.g.:

if [ -n "$GRASS_BATCH_JOB" ] ; then
	GISRCRC="$HOME/.grassrc6.`uname -n`"
	if [ ! -f "$GISRCRC" ] ; then
		GISRCRC="$HOME/.grassrc6"
	fi
else
       GISRCRC="$HOME/.grassrc6"
fi

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list