Example #1
0
File: api.py Project: deathowl/huey
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except (KeyboardInterrupt, RuntimeError):
         raise
     except:
         wrap_exception(exc_class)
Example #2
0
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except (KeyboardInterrupt, RuntimeError):
         raise
     except:
         wrap_exception(exc_class)
Example #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
Example #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
Example #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
Example #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
Example #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)
Example #8
0
 def _put(self, key, value):
     try:
         return self.result_store.put(key, value)
     except:
         return wrap_exception(DataStorePutException)
Example #9
0
 def read(self):
     try:
         return self.queue.read()
     except:
         wrap_exception(QueueReadException)
Example #10
0
 def write(self, msg):
     try:
         self.queue.write(msg)
     except:
         wrap_exception(QueueWriteException)
Example #11
0
File: api.py Project: szaydel/huey
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except:
         wrap_exception(exc_class)
Example #12
0
 def read(self):
     try:
         return self.queue.read()
     except:
         wrap_exception(QueueReadException)
Example #13
0
 def write(self, msg):
     try:
         self.queue.write(msg)
     except:
         wrap_exception(QueueWriteException)
Example #14
0
 def _remove(self, msg):
     try:
         return self.queue.remove(msg)
     except:
         wrap_exception(QueueRemoveException)
Example #15
0
 def inner(*args, **kwargs):
     try:
         return fn(*args, **kwargs)
     except:
         wrap_exception(exc_class)
Example #16
0
 def raise_keyerror():
     try:
         {}["huey"]
     except KeyError as exc:
         raise wrap_exception(MyException)
Example #17
0
 def raise_keyerror():
     try:
         {}['huey']
     except KeyError as exc:
         raise wrap_exception(MyException)