Exemplo n.º 1
0
 def inner(*args, **kwargs):
     tid = sem.acquire()
     if tid is None:
         raise TaskLockedException('unable to acquire lock: %s' %
                                   lock_name)
     try:
         return fn(*args, **kwargs)
     finally:
         sem.release(tid)
Exemplo n.º 2
0
 def __enter__(self):
     if not self._huey._put_if_empty(self._key, '1'):
         raise TaskLockedException('unable to set lock: %s' % self._name)
Exemplo n.º 3
0
 def __enter__(self):
     if not self._huey.put_if_empty(self._key, str(time.time())):
         raise TaskLockedException('unable to set lock: %s' % self._name)