class_docstr: Tests for async processing logic in horovod.elastic.
class_docstr_tok: ["Tests","for","async","processing","logic","in","horovod.elastic","."]
docstr: Tests that driver blocks until the min number of hosts and slots are available.
docstr_tok: ["Tests","that","driver","blocks","until","the","min","number","of","hosts","and","slots","are","available","."]
code: def test_wait_for_min_hosts(self):
      """Tests that driver blocks until the min number of hosts and slots are available."""
      slots = [
          {"host-1": 4},
          {"host-1": 4, "host-2": 8},
          {"host-1": 4, "host-2": 8, "host-3": 4},
      ]
      mock_discovery = mock.Mock()
      mock_discovery.find_available_hosts_and_slots.side_effect = (
          sequence(slots)
      )
  
      driver = ElasticDriver(
          mock.Mock(), mock_discovery, min_num_proc=2, max_num_proc=12
      )
      driver.wait_for_available_slots(min_num_proc=2, min_hosts=2)
  
      # Even though we only needed 2 slots, because we also needed 2 hosts, we will at least 12 slots total
      assert (
          driver._host_manager.current_hosts.count_available_slots()
          >= 12
      )
      driver.stop()
  
imports: import time
  import unittest
  import warnings
  import mock
  import pytest
  from horovod.runner.util import network
  from horovod.runner.elastic.discovery import FixedHosts, HostManager
  from horovod.runner.elastic.driver import ElasticDriver
  from horovod.runner.elastic.rendezvous import create_rendezvous_handler
  from horovod.runner.elastic.worker import HostUpdateResult, WorkerNotificationManager
  from horovod.runner.http.http_server import RendezvousServer
label_desc: Use image node_id 6 for calling the ElasticDriverTests obj's underlying member method code with example usage: obj.test_wait_for_min_hosts() without return types