On Wed, Aug 27, 2008 at 7:48 PM, Glynn Clements <[EMAIL PROTECTED]> wrote: > 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? Then $$ (PID) would do the job. too. > Actually, I really think that any "advanced" use (and I think that > includes running batch jobs on a cluster) should just bypass Init.sh > altogether and set the environment variables itself. I generally agree but I am right now too lazy/overworked to change all my tested scripts... > 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). ... [ useful comments omitted ] ... > 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? > So, for batch jobs, you shouldn't need anything beyond e.g.: > > export GISBASE=/opt/grass-7.0.svn > > export PATH="$GISBASE/bin:$GISBASE/scripts:$PATH" > export LD_LIBRARY_PATH="$GISBASE/lib" > export PYTHONPATH="$GISBASE/etc/python:$PYTHONPATH" > > export GIS_LOCK=$$ > > tmp=/tmp/grass6-"`whoami`"-$GIS_LOCK In this case: tmp=/tmp/grass6-"`whoami`"-$GIS_LOCK > export GISRC="$tmp/gisrc" > mkdir "$tmp" > cp ~/.grassrc6 "$GISRC" In this case: cp ~/.grassrc7 "$GISRC" > If it wasn't for supporting multiple sessions, you could just put the > various environment settings into the global /etc/profile, along with: > > GISRC=$HOME/.grassrc7 > > And GRASS commands can then be used like any other command (i.e. not > restricted to a GRASS session). Right. Note: On the cluster structure I am using I have my HOME and from there the jobs migrate to the various nodes (blades whatever). Then results are copied back to my HOME (in this case each job has its own MAPSET). A final batch job just copies to a common MAPSET to have all results in one place. So I do need multiple sessions, I think. Markus _______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
