code: def check_components_alive(
      cluster, component_type, check_component_alive
  ):
      """Check that a given component type is alive on all worker nodes."""
      worker_nodes = get_other_nodes(cluster)
      assert len(worker_nodes) > 0
      for node in worker_nodes:
          process = node.all_processes[component_type][0].process
          if check_component_alive:
              assert process.poll() is None
          else:
              print(
                  "waiting for "
                  + component_type
                  + " with PID "
                  + str(process.pid)
                  + "to terminate"
              )
              process.wait()
              print(
                  "done waiting for "
                  + component_type
                  + " with PID "
                  + str(process.pid)
                  + "to terminate"
              )
              assert not process.poll() is None
  
file_path: ray/python/ray/tests/test_multinode_failures.py
imports: import os
  import signal
  import sys
  import time
  import pytest
  import ray
  import ray._private.ray_constants
  from ray._private.test_utils import Semaphore, get_other_nodes
  from ray.cluster_utils import Cluster, cluster_not_supported
label_desc: Use image node_id 4 for calling a global function with example usage: check_components_alive(cluster, component_type, check_component_alive) without return types