Beispiel #1
0
 def load_persisted_data(self,**args):
     restore = args.get('restore',False)
     if restore or (self._variable == None):
         if persistenceManager.is_stored( self.stat ):
             restored_data = persistenceManager.load( self.stat )
             if restored_data is not None:
                 self.setData( restored_data )
         if self._variable is None:
             wpsLog.error( "  ERROR: Failed to retreive persisted variable '%s'", self.stat['cid'] )
Beispiel #2
0
 def stats(self,**args):
     self.stat['cid'] = args.get( 'cid', self.variable_spec['id'] )
     self.stat['rid'] = args.get( 'rid', None )
     wid = args.get( 'wid', None )
     if wid:
         self.stat['wid'] = wid
         self.stat['cache_queue'] = wid
     self.stat['inMemory'] = ( self._variable is not None )
     self.stat['persisted'] = persistenceManager.is_stored( self.stat )
     self.stat['region'] = self.spec
     return self.stat
Beispiel #3
0
 def persist(self,**args):
     if not 'persist_id' in self.stat:
         cid = args.get( 'cid', self.stat.get('cid',None) )
         if cid:  self.stat['persist_id'] = '_'.join([ re.sub("[/:]","_",cid), str(int(10*time.time()))])
     if not persistenceManager.is_stored( self.stat ):
         data = self.getData()
         if data is not None:
             persistenceManager.store( data, self.stat )
             self.stat['shape'] = list(data.shape)
             self.stat['dtype'] = data.dtype
     flush = args.get('flush',False)
     if flush and self.stat['persist_id']:
         self._variable = None