[GRASS-dev] GRASS_BATCH_JOB and GISRCRC

Glynn Clements glynn at gclements.plus.com
Wed Aug 27 19:10:40 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
> >>
> >>
> >> This change will render GISRCRC individual if running GRASS
> >> in parallel on a series of machines.
> >> For a "normal" user the behavior is as before.
> >>
> >> Any objections?
> >
> > It needs a fallback to use the normal ~/.grassrc6 if a host-specific
> > version doesn't exist.
> 
> Your comment is not entirely clear to me.
> You mean in case that `uname -n` doesn't return
> a useful string?

No, I mean in case you only have a ~/.grassrc6 file, and not a
~/.grassrc6.<hostname> file.

> Then $$ (PID) would do the job. too.

If you used $$, you would need to be able to predict the PID which
grass64/Init.sh would get before you run it, so that you could name
the file appropriately.

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.

> > Contrary to what might be assumed from the insane complexity of
> > Init.sh, manually configuring the GRASS environment can be done with
> > as little as:
> >
> ...
> >        tmp=/tmp/grass6-"`whoami`"-$GIS_LOCK
> ...
> >        cp ~/.grassrc6 "$GISRC"
> 
> Both should be grass7 I guess. (I made those changes some
> time ago).

Ultimately it doesn't actually matter. GRASS only cares that $GISRC
refers to a file which contains the necessary settings.

> > GRASS_LD_LIBRARY_PATH is only needed for running commands via an
> > xterm, so not applicable to batch jobs or 7.x.
> 
> Would it matter for GDAL-GRASS plugin and such?

Nope. The only thing that uses GRASS_LD_LIBRARY_PATH is the
grass-run.sh script, which uses it to restore LD_LIBRARY_PATH (or
whatever it's called on particular system), in case it has been reset
due to running a setuid/setgid binary (which may include xterm).

grass-run.sh no longer exists in 7.x, as it doesn't use xterm.

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


More information about the grass-dev mailing list