[GRASS-dev] [GRASS GIS] #1074: $GRASS_BATCH_JOB isn't executed

#1074: $GRASS_BATCH_JOB isn't executed
---------------------+------------------------------------------------------
Reporter: martin | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: default | Version: svn-trunk
Keywords: | Platform: Linux
      Cpu: x86-64 |
---------------------+------------------------------------------------------
GRASS SVN trunk is installed into /opt/GRASS70/ (analogously to the one in
#491). I've copied a rudimentary $GISDBASE and ~/.grass7/rc from another
machine which is capable of running a GUI. GRASS_GUI is set to text in the
rc file.

{{{
hypersphere: 10:15:36 ~> pwd
/home/martin
hypersphere: 10:15:37 ~> ls -l landcover/grassimport_pg.sh
-rwxr-xr-x 1 martin users 6590 19. Mai 09:51 landcover/grassimport_pg.sh
hypersphere: 10:15:40 ~> head -1 landcover/grassimport_pg.sh
v.in.ogr dsn="PG:host=zuluviz.optiputer.net dbname=landcover user=webuser"
layer=cstest_agroforest output=cstest_agroforest
}}}

Ok, now:

{{{
hypersphere: 10:15:44 ~> env
LOCATION=/home/martin/grassdata/world/PERMANENT
GRASS_BATCH_JOB=/home/martin/landcover/grassimport_pg.sh
/opt/GRASS70/bin/grass70
Cleaning up temporary files...
Starting GRASS GIS...
Executing '/home/martin/landcover/grassimport_pg.sh' ...
Welcome to GRASS 7.0.svn (2010)
[... nothing happens ...]
hypersphere /home/martin> exit
exit
Cleaning up temporary files...
Batch job '/home/martin/landcover/grassimport_pg.sh' (defined in
GRASS_BATCH_JOB variable) was executed.
Goodbye from GRASS GIS
}}}

Actually almost everything is fine - just the $GRASS_BATCH_JOB script
doesn't get executed as promised. When copying script lines into the GRASS
command prompt, they're being processed nicely.
Same batch setup worked perfectly with GRASS64 and I didn't encounter any
differences in the HTML manual pages, therefore I decided to file a bug.

Cheers, Martin.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
---------------------+------------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Resolution: | Keywords:
  Platform: Linux | Cpu: x86-64
---------------------+------------------------------------------------------
Changes (by neteler):

  * component: default => Python

Comment:

The code in

http://trac.osgeo.org/grass/browser/grass/trunk/lib/init/grass.py#L608

seems to be a stub:

{{{
             shell = batch_job
}}}

rather than a launch of the script.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
---------------------+------------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
---------------------+------------------------------------------------------
Changes (by hamish):

  * keywords: => startup

Comment:

One thing I've wanted to see for a long time, and grass7 init.py is a
great opportunity for, is to have better parsing of command line options
than grass 6's init.sh has. Maybe I'm just used to how good G_parser() is
by comparison..

Anyway, it would be great to be able to pass the batch job script filename
as a command line option to init.py instead of having to mess with special
environment variable hacks etc. to get it to work.

thanks,
Hamish

ps- any objections/comments to adding a "startup" component in trac?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1074#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by neteler):

  * component: Python => Startup

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1074#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Comment (by neteler):

Please try r42343.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1074#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Comment (by neteler):

Ok, r42343 is most certainly wrong. A correct fix would be appreciated.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1074#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Comment (by alf):

Hi,

using the patch below, the file specified in GRASS_BATCH_JOB variable is
executed as expected.

Alessandro Frigeri

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Comment (by martinl):

Replying to [comment:6 alf]:
> using the patch below, the file specified in GRASS_BATCH_JOB variable is
executed as expected.

thanks, slightly modified patch applied in r42535. Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Comment (by alf):

Replying to [comment:7 martinl]:
> Replying to [comment:6 alf]:
> > using the patch below, the file specified in GRASS_BATCH_JOB variable
is executed as expected.
>
> thanks, slightly modified patch applied in r42535. Martin

Good!

find another patch with the Popen wait method, that waits for the batch
job to be finished before going on.

Alessandro

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1074: $GRASS_BATCH_JOB isn't executed
----------------------+-----------------------------------------------------
  Reporter: martin | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Startup | Version: svn-trunk
Resolution: fixed | Keywords: startup
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by neteler):

  * status: new => closed
  * resolution: => fixed

Comment:

Patch tested, seems to work fine now. applied in r42536. thanks.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1074#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>