[GRASS-SVN] r66378 - grass-addons/grass7/general/g.cloud

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 29 06:44:37 PDT 2015


Author: neteler
Date: 2015-09-29 06:44:37 -0700 (Tue, 29 Sep 2015)
New Revision: 66378

Modified:
   grass-addons/grass7/general/g.cloud/cloud_collect.sh
   grass-addons/grass7/general/g.cloud/cloud_mail.sh
   grass-addons/grass7/general/g.cloud/g.cloud.py
Log:
g.cloud addon: minor updates for G7.0.x

Modified: grass-addons/grass7/general/g.cloud/cloud_collect.sh
===================================================================
--- grass-addons/grass7/general/g.cloud/cloud_collect.sh	2015-09-29 11:06:28 UTC (rev 66377)
+++ grass-addons/grass7/general/g.cloud/cloud_collect.sh	2015-09-29 13:44:37 UTC (rev 66378)
@@ -32,13 +32,13 @@
    echo ""
    echo "Usage: $0 targetgrassdbase targetlocation mail_address remove_file"
    echo ""
-   echo "targetgrassdbase = GRASSDBASE where write files"
-   echo "targetlocation = LOCATION where write files"
-   echo "mail_address = Mail address where send email when jobs finish, NOOO to no mail"
-   echo "remove_file = Remove temporary files, NOOO to no remove"  
+   echo "targetgrassdbase = GRASSDBASE where to write files"
+   echo "targetlocation = LOCATION where to write files"
+   echo "mail_address = Mail address where to send email when jobs finish, put NOOO for no email"
+   echo "remove_file = Remove temporary files, put NOOO for no removal"
    echo "" 
    echo "Example:"
-   echo "   $0 /grassdata patUTM32  launch_SGE_grassjob_rsun_energy.sh"
+   echo "   $0 /path/to/grassdata patUTM32  launch_SGE_grassjob_rsun_energy.sh"
    exit 0
 fi
 
@@ -88,11 +88,11 @@
 
 TOCOLLECTFILE=to_be_collected_$MYPID.csv
 
-ls -1 $GRASSDBROOT/$MYLOC/sge*/${MYPID} > $GRASSDBROOT/$MYLOC/$TOCOLLECTFILE
+ls -1 "$GRASSDBROOT/$MYLOC/sge*/${MYPID}" > "$GRASSDBROOT/$MYLOC/$TOCOLLECTFILE"
 
-rm -f $GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE
+rm -f "$GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE"
 for myname in `cat $GRASSDBROOT/$MYLOC/$TOCOLLECTFILE` ; do
-    basename `dirname $myname` >> $GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE
+    basename `dirname $myname` >> "$GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE"
 done
 
 LIST=`cat $GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE`
@@ -101,40 +101,41 @@
 
 
 for mapset in $LIST ; do
-    MAPS=`g.list rast mapset=$mapset`
+    MAPS=`g.list raster mapset=$mapset`
     for map in $MAPS ; do
         g.copy raster=$map@$mapset,$map --o
     done
 done
 
 for mapset in $LIST ; do
-    MAPS=`g.list rast3d mapset=$mapset`
+    MAPS=`g.list raster3d mapset=$mapset`
     for map in $MAPS ; do
         g.copy raster=$map@$mapset,$map --o
     done
 done
 
 for mapset in $LIST ; do
-    MAPS=`g.list vect mapset=$mapset`
+    MAPS=`g.list vector mapset=$mapset`
     for map in $MAPS ; do
         g.copy vector=$map@$mapset,$map --o
     done
 done
 
 if [ "$REMOVE" != "NOOO" ] ; then
-    rm -f $GRASSDBROOT/$MYLOC/$MYMAPSET/.gislock
-    rm -f $GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE
-    rm -f $GRASSDBROOT/$MYLOC/$TOCOLLECTFILE
+    rm -f "$GRASSDBROOT/$MYLOC/$MYMAPSET/.gislock"
+    rm -f "$GRASSDBROOT/$MYLOC/clean_$TOCOLLECTFILE"
+    rm -f "$GRASSDBROOT/$MYLOC/$TOCOLLECTFILE"
 
     if [ ! -z "$GRASSDBROOT" ] ; then
         if [ ! -z "$MYLOC" ] ; then
-            rm -fr $GRASSDBROOT/$MYLOC/sge*
+            rm -fr "$GRASSDBROOT/$MYLOC/sge*"
         fi
     fi
 fi
 
 if [ "$MAILADDR" != "NOOO" ] ; then
-    sh -x cloud_mail.sh $MAILADDR
+    #sh -x cloud_mail.sh $MAILADDR
+    sh cloud_mail.sh $MAILADDR
 fi
 
 rm -f $MYGISRC

Modified: grass-addons/grass7/general/g.cloud/cloud_mail.sh
===================================================================
--- grass-addons/grass7/general/g.cloud/cloud_mail.sh	2015-09-29 11:06:28 UTC (rev 66377)
+++ grass-addons/grass7/general/g.cloud/cloud_mail.sh	2015-09-29 13:44:37 UTC (rev 66378)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-FROMMAIL="me at somewhere.com" # TO BE SET
+FROMMAIL="me at example.com" # TO BE SET
 
 echo "$1 The jobs that you submitted have finished" | mail -s "Jobs finished" $1

Modified: grass-addons/grass7/general/g.cloud/g.cloud.py
===================================================================
--- grass-addons/grass7/general/g.cloud/g.cloud.py	2015-09-29 11:06:28 UTC (rev 66377)
+++ grass-addons/grass7/general/g.cloud/g.cloud.py	2015-09-29 13:44:37 UTC (rev 66378)
@@ -226,17 +226,17 @@
 	mapset_name = os.path.join(home,"grassdata%s" % pid,
 				  location_name,"PERMANENT")
 	grass.message(_("Job %s terminated, now coping the result data..." % pid))
-	conn.ssh('"cd %s; tar --exclude=DEFAULT_WIND --exclude=PROJ_INFO --exclude=PROJ_UNITS -czf %s *;"' \
+	conn.ssh('"cd %s; tar --exclude=DEFAULT_WIND --exclude=PROJ_INFO --exclude=PROJ_UNITS --exclude=PROJ_EPSG -czf %s *;"' \
 		     % (mapset_name, output_file))
 	conn.pcs(output_file, path)
 	new_mapset = os.path.join(vari['GISDBASE'],vari['LOCATION_NAME'],'gcloud%s' % pid)
 	#os.mkdir(new_mapset)
 	outtar = tarfile.open(os.path.join(path,"gcloud_result_%s.tar.gz" % pid), "r:gz")
 	outtar.extractall(path=new_mapset)
-	grass.message(_("To see the new data launch\n g.mapsets add=gcloud%s" % pid))
+	grass.message(_("To see the new data launch\n g.mapsets mapset=gcloud operation=add%s" % pid))
     else:
-	grass.message(_("Job %s it is not terminated yet" % pid))
-    return  
+	grass.message(_("Job %s not yet completed..." % pid))
+    return
 
 # main function
 def main():
@@ -260,7 +260,7 @@
         grassVersion = 'grass%s%s' % (version['version'][0],version['version'][2])
         session_path = '.grass%s' % version['version'][0]
     else:
-        grass.fatal(_('You are not in GRASS GIS version 7'))
+        grass.fatal(_('You are not in a GRASS GIS version 7 session'))
         return 0
     # set the path of grassdata/location/mapset
     # set to .grass7 folder
@@ -333,8 +333,9 @@
 	ssh_conn.ssh('mkdir -p %s' % new_perm)
 	tar = tarfile.open("PERMANENT.tar.gz", "w:gz")
 	tar.add(os.path.join(permanent,'PROJ_INFO'),'PROJ_INFO')
+	tar.add(os.path.join(permanent,'PROJ_UNITS'),'PROJ_UNITS')
+	tar.add(os.path.join(permanent,'PROJ_EPSG'),'PROJ_EPSG')
 	tar.add(os.path.join(permanent,'DEFAULT_WIND'),'DEFAULT_WIND')
-	tar.add(os.path.join(permanent,'PROJ_UNITS'),'PROJ_UNITS')
 	tar.add(os.path.join(permanent,'WIND'),'WIND')
 	if os.path.isfile(os.path.join(permanent,'VAR')):
 	    tar.add(os.path.join(permanent,'VAR'),'VAR')



More information about the grass-commit mailing list