code: def test_run_random_searcher_exp_core_api(
      config_name: str,
      exp_name: str,
      exception_points: List[str],
      metric_as_dict: bool,
  ) -> None:
      config = conf.load_config(
          conf.fixtures_path(
              "custom_searcher/core_api_searcher_random.yaml"
          )
      )
      config["entrypoint"] += " --exp-name " + exp_name
      config["entrypoint"] += " --config-name " + config_name
      if len(exception_points) > 0:
          config["entrypoint"] += " --exception-points " + " ".join(
              exception_points
          )
      if metric_as_dict:
          config["entrypoint"] += " --metric-as-dict"
      config["max_restarts"] = len(exception_points)
  
      experiment_id = exp.run_basic_test_with_temp_config(
          config, conf.fixtures_path("custom_searcher"), 1
      )
  
      session = api_utils.determined_test_session()
  
      # searcher experiment
      searcher_exp = bindings.get_GetExperiment(
          session, experimentId=experiment_id
      ).experiment
      assert searcher_exp.state == bindings.experimentv1State.COMPLETED
  
      # actual experiment
      response = bindings.get_GetExperiments(session, name=exp_name)
      experiments = response.experiments
      assert len(experiments) == 1
  
      experiment = experiments[0]
      assert experiment.numTrials == 5
  
      trials = bindings.get_GetExperimentTrials(
          session, experimentId=experiment.id
      ).trials
  
      ok = True
      for trial in trials:
          ok = ok and check_trial_state(
              trial, bindings.trialv1State.COMPLETED
          )
      assert ok, "some trials failed"
  
      for trial in trials:
          assert trial.totalBatchesProcessed == 500
  
      # check logs to ensure failures actually happened
      logs = str(
          subprocess.check_output(
              [
                  "det",
                  "-m",
                  conf.make_master_url(),
                  "experiment",
                  "logs",
                  str(experiment_id),
              ]
          )
      )
      failures = logs.count(
          "Max retries exceeded with url: http://dummyurl (Caused by None)"
      )
      assert failures == len(exception_points)
  
      # check for resubmitting operations
      resubmissions = logs.count(
          "determined.searcher: Resubmitting operations for event.id="
      )
      assert resubmissions == sum(
          [x == "after_save" for x in exception_points]
      )
  
imports: import logging
  import pathlib
  import subprocess
  import tempfile
  import time
  from typing import Iterator, List, Optional
  import pytest
  from urllib3 import connectionpool
  from determined import searcher
  from determined.common import util
  from determined.common.api import bindings
  from determined.experimental import client
  from tests import api_utils
  from tests import config
  from tests import experiment
  from tests.fixtures.custom_searcher import searchers
label_desc: Use image node_id 5 for calling a global function with example usage: test_run_random_searcher_exp_core_api(config_name, exp_name, exception_points, metric_as_dict) without return types