[GRASS-dev] [GRASS GIS] #2151: g.gui.* modules which use temporal framework leave processes after exiting

GRASS GIS trac at osgeo.org
Thu Jan 2 19:45:53 PST 2014


#2151: g.gui.* modules which use temporal framework leave processes after exiting
--------------------------------------------+-------------------------------
 Reporter:  annakrat                        |       Owner:  grass-dev@…              
     Type:  defect                          |      Status:  new                      
 Priority:  normal                          |   Milestone:  7.0.0                    
Component:  Python                          |     Version:  svn-trunk                
 Keywords:  g.gui.animation, temporal, RCP  |    Platform:  Linux                    
      Cpu:  All                             |  
--------------------------------------------+-------------------------------

Comment(by huhabla):

 It seems to me that the g.gui.timeline child process is still alive after
 the fork. The init process is the new parent of the forked child??

 I have patched g.gui.timeline a make it a bit faster and to assure at
 least the termination of the messenger and C-interface subprocesses of the
 temporal framework:

 {{{
 #!diff
 Index: timeline/frame.py
 ===================================================================
 --- timeline/frame.py   (Revision 58582)
 +++ timeline/frame.py   (Arbeitskopie)
 @@ -78,7 +78,18 @@
          self._layout()
          self.temporalType = None
          self.unit = None
 +        # We create a database interface here to speedup the GUI
 +        self.dbif = tgis.SQLDatabaseInterfaceConnection()
 +        self.dbif.connect()

 +    def __del__(self):
 +        """!Close the database interface and stop the messenger and
 C-interface
 +           subprocesses.
 +        """
 +        if self.dbif.connected is True:
 +            self.dbif.close()
 +        tgis.stop_subprocesses()
 +
      def _layout(self):
          """!Creates the main panel with all the controls on it:
               * mpl canvas
 @@ -145,15 +156,16 @@
          self.timeData = {}
          mode = None
          unit = None
 +
          for series in timeseries:
              name = series[0] + '@' + series[1]
              etype = series[2]
              sp = tgis.dataset_factory(etype, name)
 -            if not sp.is_in_db():
 +            if not sp.is_in_db(dbif=self.dbif):
                  GError(self, message=_("Dataset <%s> not found in
 temporal database") % (name))
                  return

 -            sp.select()
 +            sp.select(dbif=self.dbif)

              self.timeData[name] = {}
              self.timeData[name]['elementType'] = series[2]
 @@ -167,8 +179,8 @@
                  return

              # check topology
 -            maps = sp.get_registered_maps_as_objects()
 -            self.timeData[name]['validTopology'] =
 sp.check_temporal_topology(maps)
 +            maps = sp.get_registered_maps_as_objects(dbif=self.dbif)
 +            self.timeData[name]['validTopology'] =
 sp.check_temporal_topology(maps=maps, dbif=self.dbif)

              self.timeData[name]['temporalMapType'] = sp.get_map_time()  #
 point/interval
              self.timeData[name]['unit'] = None  # only with relative
 @@ -194,7 +206,7 @@
                                  'north', 'south', 'west', 'east'])

              rows = sp.get_registered_maps(columns=columns, where=None,
 -                                          order='start_time', dbif=None)
 +                                          order='start_time',
 dbif=self.dbif)
              if rows is None:
                  rows = []
              for row in rows:
 @@ -385,7 +397,7 @@
          @return (mapName, mapset, type)
          """
          validated = []
 -        tDict = tgis.tlist_grouped('stds', group_type=True)
 +        tDict = tgis.tlist_grouped('stds', group_type=True,
 dbif=self.dbif)
          # nested list with '(map, mapset, etype)' items
          allDatasets = [[[(map, mapset, etype) for map in maps]
                       for etype, maps in etypesDict.iteritems()]
 }}}

 The patch is not applied yet, since it does not solve the issue that the
 child process is still alive. Maybe an explicit os.exit() should be added
 to g.gui.timeline? How about an exit button?

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2151#comment:8>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list