async def set_lock(self, resource, lock_identifier):
        """
        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
        :return float: The elapsed time that took to lock the instances
            in seconds
        :raises: LockError if the lock has not been set to at least (N/2 + 1)
            instances
        """
        start_time = time.time()
        lock_timeout = self.lock_timeout

        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.time() - start_time
        locked = True if successful_sets >= int(len(self.instances) / 2) + 1 else False

        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 LockError('Can not acquire the lock "%s"' % resource)

        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
        :return float: The elapsed time that took to lock the instances
            in seconds
        :raises: LockError if the lock has not been set to at least (N/2 + 1)
            instances