docstr: Makes sure we don't block indefinitely on ventilator queue
docstr_tok: ["Makes","sure","we","do","n't","block","indefinitely","on","ventilator","queue"]
code: def test_stop_when_result_queue_is_full(self):
      """Makes sure we don't block indefinitely on ventilator queue"""
      SLEEP_DELTA = 0.01
      TIMEOUT = 20
      QUEUE_SIZE = 2
  
      pool = ThreadPool(10, results_queue_size=QUEUE_SIZE)
      pool.start(WorkerIdGeneratingWorker)
  
      for _ in range(100):
          pool.ventilate()
  
      cumulative_wait = 0
      while pool.results_qsize() != QUEUE_SIZE:
          time.sleep(SLEEP_DELTA)
          cumulative_wait += SLEEP_DELTA
          # Make sure we wait no longer than the timeout. Otherwise, something is very wrong
          self.assertLess(
              cumulative_wait,
              TIMEOUT,
              msg="Timeout while waiting for the results queue to fill",
          )
  
      # No need to read from the queue. We are testing ability to exit when workers might be blocked on the
      # results queue
  
      pool.stop()
      pool.join()
  
imports: import time
  import unittest
  import numpy
  from multiprocessing import Process, Manager
  from psutil import pid_exists
  from petastorm.workers_pool import EmptyResultError
  from petastorm.workers_pool.dummy_pool import DummyPool
  from petastorm.workers_pool.process_pool import ProcessPool
  from petastorm.workers_pool.tests.stub_workers import CoeffMultiplierWorker, WorkerIdGeneratingWorker, WorkerMultiIdGeneratingWorker, SleepyWorkerIdGeneratingWorker, ExceptionGeneratingWorker_5, PreprogrammedReturnValueWorker
  from petastorm.workers_pool.thread_pool import ThreadPool
label_desc: Use image node_id 14 for calling the TestWorkersPool obj's underlying member method code with example usage: obj.test_stop_when_result_queue_is_full() without return types