code: def test_trial_reuse_with_failing(
      trainable, ray_start_1_cpu, tmp_path
  ):
      """Test that failing actors won't be reused.
  
      - 1 trial can run at a time
      - Some trials are failing
      - We assert that trials after failing trials are scheduled on fresh actors
          (num_resets = 0)
      - We assert that trials after successful trials are schedule on reused actors
          (num_reset = last_num_resets + 1)
      """
      fail = [
          False,
          True,
          False,
          False,
          True,
          True,
          False,
          False,
          False,
      ]
      trials = tune.run(
          trainable,
          reuse_actors=True,
          config={
              "id": tune.grid_search(list(range(9))),
              "fail": tune.sample_from(
                  lambda config: fail[config["id"]]
              ),
              "marker_dir": tmp_path,
          },
          raise_on_failed_trial=False,
      ).trials
  
      assert [t.last_result.get("iter") for t in trials] == [
          2,
          None,
          2,
          2,
          None,
          None,
          2,
          2,
          2,
      ]
      assert [t.last_result.get("num_resets") for t in trials] == [
          0,
          None,
          0,
          1,
          None,
          None,
          0,
          1,
          2,
      ]
  
imports: import inspect
  import os
  from pathlib import Path
  import tempfile
  from typing import Callable
  import pytest
  import sys
  import time
  import ray
  from ray import train, tune, logger
  from ray.train import CheckpointConfig
  from ray.tune import Trainable, run_experiments, register_trainable
  from ray.tune.error import TuneError
  from ray.tune.result_grid import ResultGrid
  from ray.tune.schedulers.trial_scheduler import FIFOScheduler, TrialScheduler
  from ray.tune.tune import _check_mixin
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 10 for calling a global function with example usage: test_trial_reuse_with_failing(trainable, ray_start_1_cpu, tmp_path) without return types