Пример #1
0
def fragment_lock(fid):
    """
    :param fid: Fragment id
    :return: A redis-based lock object for a given fragment
    """
    lock_key = '{}:{}:lock'.format(fragments_key, fid)
    return r.lock(lock_key, lock_class=Lock)
Пример #2
0
 def _load(self):
     super(StreamSink, self)._load()
     # Create the request lock
     lock_key = '{}lock'.format(self._request_key)
     self.__lock = r.lock(lock_key, lock_class=Lock)
Пример #3
0
 def uuid_lock(uuid):
     lock_key = '{}:cache:{}:lock'.format(AGENT_ID, uuid)
     return r.lock(lock_key, lock_class=RedisLock)