Opened 14 years ago

Closed 14 years ago

#1074 closed defect (fixed)

$GRASS_BATCH_JOB isn't executed

Reported by: martin Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Startup Version: svn-trunk
Keywords: startup Cc:
CPU: x86-64 Platform: Linux

Description

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.

Attachments (2)

grass.py.patch (391 bytes ) - added by alf 14 years ago.
patch to lib/init/grass.py
grass.py.patch3 (1.0 KB ) - added by alf 14 years ago.
grass7 init file - patch 3

Download all attachments as: .zip

Change History (11)

comment:1 by neteler, 14 years ago

Component: defaultPython

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.

comment:2 by hamish, 14 years ago

Keywords: startup added

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?

comment:3 by neteler, 14 years ago

Component: PythonStartup

comment:4 by neteler, 14 years ago

Please try r42343.

comment:5 by neteler, 14 years ago

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

by alf, 14 years ago

Attachment: grass.py.patch added

patch to lib/init/grass.py

comment:6 by alf, 14 years ago

Hi,

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

Alessandro Frigeri

in reply to:  6 ; comment:7 by martinl, 14 years ago

Replying to 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

in reply to:  7 comment:8 by alf, 14 years ago

Replying to martinl:

Replying to 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

by alf, 14 years ago

Attachment: grass.py.patch3 added

grass7 init file - patch 3

comment:9 by neteler, 14 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.