docstr: Tests that we dont surpass a max ventilation size in each pool type
  (since it relies on accurate ventilation size reporting)
docstr_tok: ["Tests","that","we","dont","surpass","a","max","ventilation","size","in","each","pool","type","(","since","it","relies","on","accurate","ventilation","size","reporting",")"]
code: def test_max_ventilation_size(self):
      """Tests that we dont surpass a max ventilation size in each pool type
      (since it relies on accurate ventilation size reporting)"""
      max_ventilation_size = 10
  
      for pool in [DummyPool(), ProcessPool(10), ThreadPool(10)]:
          ventilator = ConcurrentVentilator(
              ventilate_fn=pool.ventilate,
              items_to_ventilate=[{"item": i} for i in range(100)],
              max_ventilation_queue_size=max_ventilation_size,
          )
          pool.start(IdentityWorker, ventilator=ventilator)
  
          # Give time for the thread to fill the ventilation queue
          while (
              ventilator._ventilated_items_count
              - ventilator._processed_items_count
              < max_ventilation_size
          ):
              time.sleep(0.1)
  
          # After stopping the ventilator queue, we should only get 10 results
          ventilator.stop()
          for _ in range(max_ventilation_size):
              pool.get_results()
  
          with self.assertRaises(EmptyResultError):
              pool.get_results()
  
          pool.stop()
          pool.join()
  
imports: import time
  import unittest
  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 IdentityWorker
  from petastorm.workers_pool.thread_pool import ThreadPool
  from petastorm.workers_pool.ventilator import ConcurrentVentilator
label_desc: Use image node_id 5 for calling the TestWorkersPool obj's underlying member method code with example usage: obj.test_max_ventilation_size() without return types