def testWaitingForSomeButNotAllParallelInvocations(self):
    pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY)
    for ((group, method), test_messages_sequence) in six.iteritems(self._digest.unary_unary_messages_sequences):
        for test_messages in test_messages_sequence:
            requests = []
            response_futures_to_indices = {}
            for index in range(test_constants.THREAD_CONCURRENCY):
                request = test_messages.request()
                inner_response_future = self._invoker.future(group, method)(request, test_constants.LONG_TIMEOUT)
                outer_response_future = pool.submit(inner_response_future.result)
                requests.append(request)
                response_futures_to_indices[outer_response_future] = index
            some_completed_response_futures_iterator = itertools.islice(futures.as_completed(response_futures_to_indices), (test_constants.THREAD_CONCURRENCY // 2))
            for response_future in some_completed_response_futures_iterator:
                index = response_futures_to_indices[response_future]
                test_messages.verify(requests[index], response_future.result(), self)
    pool.shutdown(wait=True)
def testWaitingForSomeButNotAllParallelInvocations(self):
    pool = logging_pool.pool(test_constants.THREAD_CONCURRENCY)
    for ((group, method), test_messages_sequence) in six.iteritems(self._digest.unary_unary_messages_sequences):
        for test_messages in test_messages_sequence:
            requests = []
            response_futures_to_indices = {}
            for index in range(test_constants.THREAD_CONCURRENCY):
                request = test_messages.request()
                inner_response_future = self._invoker.future(group, method)(request, test_constants.LONG_TIMEOUT)
                outer_response_future = pool.submit(inner_response_future.result)
                requests.append(request)
                response_futures_to_indices[outer_response_future] = index
            some_completed_response_futures_iterator = itertools.islice(futures.as_completed(response_futures_to_indices), (test_constants.THREAD_CONCURRENCY // 2))
            for response_future in some_completed_response_futures_iterator:
                index = response_futures_to_indices[response_future]
                test_messages.verify(requests[index], response_future.result(), self)
    pool.shutdown(wait=True)