(self, resource, lock_identifier, lock_timeout=10.0)
return elapsed_time
Tries to set the lock to all the redis instances

        :param resource: The resource string name to lock
        :param lock_identifier: The id of the lock. A unique string
        :param lock_timeout: lock's lifetime
        :return float: The elapsed time that took to lock the instances
            in seconds
        :raises: LockRuntimeError or LockAcquiringError or LockError if the lock has not
            been set to at least (N/2 + 1) instances
Tries to set the lock to all the redis instances
Tries to set the lock to all the redis instances
async def set_lock(self, resource, lock_identifier, lock_timeout=10.0):
        """
        Tries to set the lock to all the redis instances

        :param resource: The resource string name to lock
        :param lock_identifier: The id of the lock. A unique string
        :param lock_timeout: lock's lifetime
        :return float: The elapsed time that took to lock the instances
            in seconds
        :raises: LockRuntimeError or LockAcquiringError or LockError if the lock has not
            been set to at least (N/2 + 1) instances
        """
        start_time = time.monotonic()

        successes = await asyncio.gather(*[
            i.set_lock(resource, lock_identifier, lock_timeout) for
            i in self.instances
        ], return_exceptions=True)
        successful_sets = sum(s is None for s in successes)

        elapsed_time = time.monotonic() - start_time
        locked = successful_sets >= int(len(self.instances) / 2) + 1

        self.log.debug('Lock "%s" is set on %d/%d instances in %s seconds',
                       resource, successful_sets, len(self.instances), elapsed_time)

        if not locked:
            raise_error(successes, 'Can not acquire the lock "%s"' % resource)

        return elapsed_time
async def set_lock ( self , resource , lock_identifier , lock_timeout = 10.0 ) : start_time = time . monotonic ( ) successes = await asyncio . gather ( * [ i . set_lock ( resource , lock_identifier , lock_timeout ) for i in self . instances ] , return_exceptions = True ) successful_sets = sum ( s is None for s in successes ) elapsed_time = time . monotonic ( ) - start_time locked = successful_sets >= int ( len ( self . instances ) / 2 ) + 1 self . log . debug ( 'Lock "%s" is set on %d/%d instances in %s seconds' , resource , successful_sets , len ( self . instances ) , elapsed_time ) if not locked : raise_error ( successes , 'Can not acquire the lock "%s"' % resource ) return elapsed_time