[GRASS-dev] m.nviz.image - Bad server connection

epi massimodisasha at gmail.com
Sat Feb 8 11:44:41 PST 2014


Markus, Hamish,

thank you so much!
starting my SSH session with:

    ssh  -Y -C -C -l username my.server.host 

works perfect when i start grass from the SSH shell.
but my “real-use case" is a bit different

I’m used to run grass from inside an IPython notebook
to have grass loaded in the notebook session, i make a simple bash script :  ‘ ipython_GRASS.sh ‘
that looks like :


PREFIX=/home/$USER/Envs/env1

export LD_LIBRARY_PATH=$PREFIX/lib:$PREFIX/grass-7.0.svn/lib:$PREFIX/lib/R/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=$PREFIX/grass-7.0.svn/etc/python:$PYTHONPATH
export GISBASE=$PREFIX/grass-7.0.svn/
export PATH=$PREFIX/bin/:$GISBASE/bin:$GISBASE/scripts:$PATH


export GIS_LOCK=$$

mkdir -p /home/$USER/Envs/grass7data
mkdir -p /home/$USER/Envs/.grass7

export GISRC=/home/$USER/Envs/.grass7/rc

export GISDBASE=/home/$USER/Envs/grass7data

export GRASS_TRANSPARENT=TRUE
export GRASS_TRUECOLOR=TRUE
export GRASS_PNG_COMPRESSION=9
export GRASS_PNG_AUTO_WRITE=TRUE


ipython notebook —ip=xxx.xxx.xxx



in this way i can start the notebook server from the SSH shell with :

    nohup sh ipython_GRASS.sh &

and all works fine.

of course if i quit the SSH shell i will loose all the “ X support ” from my local machine.

Do you have any hints on how to export the X support inside the ipython_GRASS.sh  in order to tell grass to use the server X ?


I’m asking because i’m using the script in a crontab file that is loaded at each reboot :

@reboot nohup sh ipython_GRASS.sh &

so to have the notebook server always up and running without the needs to login into ssh all the time
It works .. but except for the bad server connection.

Thanks for any hints!

Massimo.



On Feb 7, 2014, at 10:11 PM, Hamish <hamish_b at yahoo.com> wrote:

> epi wrote:
> 
>>> i'm tring to generate a 3d image with m.nviz.image,
>>> the following command works fine form a 'standard'
>>> GRASS session in text mode on my laptop but if try
>>> to run the same command on a sever while i'm connected
>>> via SSH i got the error : Bad server connection
> 
> MarkusN:
>> Many grass power users work like this, so that's well
>> tested in general.
> 
> I was doing it with m.nviz.image last weekend actually.
> 
> Note wrt running remotely on a server, m.nviz.image is special.
> 
> 
>>> Have you any clue on how to fix this ?
>>> is there any environment var that needs to be exported
>>> in order to have m.nviz.image running during an SSH session ?
>>> 
>>> GRASS 7.0.svn (nc_spm_08_grass7):~ > m.nviz.image \
>>> elevation_map=elevation \
>>> output=elevation_3d \
>>> perspective=15 \
>>> height=2000 \
>>> color_map=elevation \
>>> resolution_fine=1 \
>>> resolution_coarse=1 \
>>> format=tif
>>> 
>>> 
>>> ERROR: Bad server connection
>> 
>> 
>> Did you redirect the Display stream?
>> 
>> ssh -Y yourserver
>> 
>> Perhaps that solving the issue.
> 
> Depending on if it's a local gigabit network or if you are calling in from home, I'd strongly suggest to use 'ssh -C' as well, since m.nviz.image will want to do about half of its processing on the *local* X server, not the remote computer, and that's a lot of network traffic!
> 
> Last weekend's task was running m.nviz.image many times in a loop for an animation, and trying to do it remotely from my netbook via a GNU Screen session. But the network connection out at the farm wasn't that good and the several years old netbook's graphics hardware is pretty poor compared to the graphics card in the remote workstation. It took ~10 times as long running it remotely, but it did get there.
> 
> m.nviz.image didn't work (entirely from the command line) when the DISPLAY enviro var wasn't set correctly in GNU Screen though, I had to reestablish the session to fix that first.
> 
> 
> good luck,
> Hamish
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140208/c4551314/attachment.html>


More information about the grass-dev mailing list