code: def test_max_num_proc(ray_8_cpus):
      with fault_tolerance_patches():
          discovery_schedule = [
              (10, ["host-1:2"]),
              (None, ["host-1:2", "host-4:1", "host-5:1"]),
          ]
          nics = list(psutil.net_if_addrs().keys())[0]
  
          settings = ElasticRayExecutor.create_settings(
              min_num_proc=1, max_num_proc=2, nics={nics}
          )
          settings.discovery = SimpleTestDiscovery(discovery_schedule)
          executor = ElasticRayExecutor(
              settings, cpus_per_slot=1, override_discovery=False
          )
  
          training_fn = _create_training_function(iterations=20)
          executor.start()
          trace = StatusCallback()
          results = executor.run(training_fn, callbacks=[trace])
          assert len(results) == 2
  
          events = trace.fetch()
          assert sum(int("started" in e) for e in events) == 2, events
          assert sum(int("finished" in e) for e in events) == 2, events
  
imports: from contextlib import contextmanager
  import psutil
  import os
  import socket
  import time
  import mock
  import pytest
  import ray
  from horovod.common.util import gloo_built
  from horovod.runner.elastic.discovery import HostDiscovery
  from horovod.ray.elastic import ElasticRayExecutor, RayHostDiscovery
label_desc: Use image node_id 8 for calling a global function with example usage: test_max_num_proc(ray_8_cpus) without return types