Example #1
0
 def restore(self):
     """
     Restore ticker_storage from database and re-initialize the handler from storage. This is triggered by the server at restart.
     """
     # load stored command instructions and use them to re-initialize handler
     ticker_storage = ServerConfig.objects.conf(key=self.save_name)
     if ticker_storage:
         self.ticker_storage = dbunserialize(ticker_storage)
         #print "restore:", self.ticker_storage
         for (obj, interval), (args, kwargs) in self.ticker_storage.items():
             obj = unpack_dbobj(obj)
             _, store_key = self._store_key(obj, interval)
             self.ticker_pool.add(store_key, obj, interval, *args, **kwargs)
Example #2
0
 def restore(self):
     """
     Restore ticker_storage from database and re-initialize the handler from storage. This is triggered by the server at restart.
     """
     # load stored command instructions and use them to re-initialize handler
     ticker_storage = ServerConfig.objects.conf(key=self.save_name)
     if ticker_storage:
         self.ticker_storage = dbunserialize(ticker_storage)
         #print "restore:", self.ticker_storage
         for (obj, interval), (args, kwargs) in self.ticker_storage.items():
             obj = unpack_dbobj(obj)
             _, store_key = self._store_key(obj, interval)
             self.ticker_pool.add(store_key, obj, interval, *args, **kwargs)
Example #3
0
    def restore(self):
        """
        Restore the command_storage from database and re-initialize the handler from storage.. This is
        only triggered after a server reload, not after a shutdown-restart
        """
        # load stored command instructions and use them to re-initialize handler
        tracker_storage = ServerConfig.objects.conf(key="oob_tracker_storage")
        if tracker_storage:
            self.oob_tracker_storage = dbunserialize(tracker_storage)
            #print "recovered from tracker_storage:", self.oob_tracker_storage
            for (obj, sessid, fieldname, trackerclass, args, kwargs) in self.oob_tracker_storage.values():
                self.track(unpack_dbobj(obj), sessid, fieldname, trackerclass, *args, **kwargs)
            # make sure to purce the storage
            ServerConfig.objects.conf(key="oob_tracker_storage", delete=True)

        repeat_storage = ServerConfig.objects.conf(key="oob_repeat_storage")
        if repeat_storage:
            self.oob_repeat_storage = dbunserialize(repeat_storage)
            #print "recovered from repeat_storage:", self.oob_repeat_storage
            for (obj, sessid, func_key, interval, args, kwargs) in self.oob_repeat_storage.values():
                self.repeat(unpack_dbobj(obj), sessid, func_key, interval, *args, **kwargs)
            # make sure to purge the storage
            ServerConfig.objects.conf(key="oob_repeat_storage", delete=True)
Example #4
0
 def restore(self):
     """
     Restore the command_storage from database and re-initialize the handler from storage.. This is
     only triggered after a server reload, not after a shutdown-restart
     """
     # load stored command instructions and use them to re-initialize handler
     tracker_storage = ServerConfig.objects.conf(key="oob_tracker_storage")
     if tracker_storage:
         self.oob_tracker_storage = dbunserialize(tracker_storage)
         for (obj, sessid, fieldname, trackerclass, args,
              kwargs) in self.oob_tracker_storage.values():
             #print "restoring tracking:",obj, sessid, fieldname, trackerclass
             self._track(unpack_dbobj(obj), sessid, fieldname, trackerclass,
                         *args, **kwargs)
         # make sure to purge the storage
         ServerConfig.objects.conf(key="oob_tracker_storage", delete=True)
     self.tickerhandler.restore()