Exemplo n.º 1
0
Arquivo: api.py Projeto: deathowl/huey
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except (KeyboardInterrupt, RuntimeError):
         raise
     except:
         wrap_exception(exc_class)
Exemplo n.º 2
0
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except (KeyboardInterrupt, RuntimeError):
         raise
     except:
         wrap_exception(exc_class)
Exemplo n.º 3
0
    def _get(self):
        if self._result is EmptyData:
            try:
                res = self.result_store.get(self.task_id)
            except:
                wrap_exception(DataStoreGetException)

            if res is not EmptyData:
                self._result = pickle.loads(res)
                return self._result
            else:
                return res
        else:
            return self._result
Exemplo n.º 4
0
 def _get(self):
     if self._result is EmptyData:
         try:
             res = self.result_store.get(self.task_id)
         except:
             wrap_exception(DataStoreGetException)
         
         if res is not EmptyData:
             self._result = pickle.loads(res)
             return self._result
         else:
             return res
     else:
         return self._result
Exemplo n.º 5
0
    def execute(self, command):
        if not isinstance(command, QueueCommand):
            raise TypeError('Unknown object: %s' % command)
        
        result = command.execute()

        if result is None and not self.store_none:
            return
        
        if self.result_store and not isinstance(command, PeriodicQueueCommand):
            serialized = pickle.dumps(result)
            try:
                self.result_store.put(command.task_id, serialized)
            except:
                wrap_exception(DataStorePutException)
        
        return result
Exemplo n.º 6
0
    def execute(self, command):
        if not isinstance(command, QueueCommand):
            raise TypeError('Unknown object: %s' % command)

        result = command.execute()

        if result is None and not self.store_none:
            return

        if self.result_store and not isinstance(command, PeriodicQueueCommand):
            serialized = pickle.dumps(result)
            try:
                self.result_store.put(command.task_id, serialized)
            except:
                wrap_exception(DataStorePutException)

        return result
Exemplo n.º 7
0
 def _get(self, key, peek=False):
     try:
         if peek:
             return self.result_store.peek(key)
         else:
             return self.result_store.get(key)
     except:
         return wrap_exception(DataStoreGetException)
Exemplo n.º 8
0
 def _put(self, key, value):
     try:
         return self.result_store.put(key, value)
     except:
         return wrap_exception(DataStorePutException)
Exemplo n.º 9
0
 def read(self):
     try:
         return self.queue.read()
     except:
         wrap_exception(QueueReadException)
Exemplo n.º 10
0
 def write(self, msg):
     try:
         self.queue.write(msg)
     except:
         wrap_exception(QueueWriteException)
Exemplo n.º 11
0
Arquivo: api.py Projeto: szaydel/huey
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except:
         wrap_exception(exc_class)
Exemplo n.º 12
0
 def read(self):
     try:
         return self.queue.read()
     except:
         wrap_exception(QueueReadException)
Exemplo n.º 13
0
 def write(self, msg):
     try:
         self.queue.write(msg)
     except:
         wrap_exception(QueueWriteException)
Exemplo n.º 14
0
 def _remove(self, msg):
     try:
         return self.queue.remove(msg)
     except:
         wrap_exception(QueueRemoveException)
Exemplo n.º 15
0
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except:
         wrap_exception(exc_class)
Exemplo n.º 16
0
 def raise_keyerror():
     try:
         {}["huey"]
     except KeyError as exc:
         raise wrap_exception(MyException)
Exemplo n.º 17
0
 def raise_keyerror():
     try:
         {}['huey']
     except KeyError as exc:
         raise wrap_exception(MyException)