code: def test_worker_failure_2(ray_start_4_cpus):
      def train_func():
          for _ in range(2):
              train.report(dict(loss=1))
  
      def train_actor_failure():
          for _ in range(2):
              train.report(dict(loss=1))
          import sys
  
          sys.exit(1)
  
      new_backend_executor_cls = gen_new_backend_executor(
          train_actor_failure
      )
  
      config = BackendConfig()
  
      iterator = create_iterator(
          train_func,
          config,
          backend_executor_cls=new_backend_executor_cls,
      )
      for worker_results in iterator:
          assert all(
              result.metrics["loss"] == 1 for result in worker_results
          )
  
imports: import functools
  import time
  from unittest.mock import patch
  import pytest
  import ray
  from ray import train
  from ray.air._internal.util import StartTraceback
  from ray.train import DataConfig
  from ray.train._internal.backend_executor import BackendExecutor
  from ray.train._internal.session import get_session, init_session
  from ray.train._internal.utils import construct_train_func
  from ray.train._internal.worker_group import WorkerGroup
  from ray.train.backend import BackendConfig
  from ray.train.examples.pytorch.torch_linear_example import train_func
  from ray.train.examples.tf.tensorflow_mnist_example import train_func
  from ray.train.tests.util import mock_storage_context
  from ray.train.trainer import TrainingIterator
label_desc: Use image node_id 9 for calling a global function with example usage: test_worker_failure_2(ray_start_4_cpus) without return types