code: def test_num_errors_terminated(ray_start_2_cpus, tmp_path):
      def train_fn(config):
          if config["id"] == 1:
              raise RuntimeError()
          else:
              train.report({"score": config["id"]})
  
      tuner = tune.Tuner(
          train_fn,
          param_space={"id": tune.grid_search([1, 2])},
          run_config=train.RunConfig(storage_path=str(tmp_path)),
      )
  
      result_grid = tuner.fit()
      assert result_grid.num_errors == 1
      assert result_grid.num_terminated == 1
      assert isinstance(result_grid.errors[0], RuntimeError)
  
file_path: ray/python/ray/tune/tests/test_result_grid.py
imports: import pytest
  import ray
  from ray import train, tune
  from ray.train import Checkpoint, Result
  from ray.tune.result_grid import ResultGrid
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
label_desc: Use image node_id 9 for calling a global function with example usage: test_num_errors_terminated(ray_start_2_cpus, tmp_path) without return types