code: def test_worker_restart(ray_start_2_cpus):
      wg = WorkerGroup(num_workers=2)
      with pytest.raises(RuntimeError):
          wg.start()
      # Avoid race condition.
      time.sleep(1)
      wg.shutdown(0)
      wg.start()
      wg.execute(lambda: 1)
  
imports: import time
  from collections import defaultdict
  import pytest
  import ray
  import ray._private.ray_constants
  from ray.train._internal.worker_group import Worker, WorkerGroup, WorkerMetadata
label_desc: Use image node_id 7 for calling a global function with example usage: test_worker_restart(ray_start_2_cpus) without return types