code: def test_run_asha_batches_exp(
      tmp_path: pathlib.Path, client_login: None
  ) -> None:
      config = conf.load_config(
          conf.fixtures_path("no_op/adaptive.yaml")
      )
      config["searcher"] = {
          "name": "custom",
          "metric": "validation_error",
          "smaller_is_better": True,
          "unit": "batches",
      }
      config["name"] = "asha"
      config["description"] = "custom searcher"
  
      max_length = 2000
      max_trials = 16
      num_rungs = 3
      divisor = 4
  
      search_method = searchers.ASHASearchMethod(
          max_length, max_trials, num_rungs, divisor, test_type="noop"
      )
      search_runner = searcher.LocalSearchRunner(
          search_method, tmp_path
      )
      experiment_id = search_runner.run(
          config, model_dir=conf.fixtures_path("no_op")
      )
  
      assert client._determined is not None
      session = client._determined._session
      response = bindings.get_GetExperiment(
          session, experimentId=experiment_id
      )
  
      assert response.experiment.numTrials == 16
      assert search_method.asha_search_state.pending_trials == 0
      assert search_method.asha_search_state.completed_trials == 16
      assert len(search_runner.state.trials_closed) == len(
          search_method.asha_search_state.closed_trials
      )
  
      response_trials = bindings.get_GetExperimentTrials(
          session, experimentId=experiment_id
      ).trials
  
      # 16 trials in rung 1 (#batches = 125)
      assert (
          sum(t.totalBatchesProcessed >= 125 for t in response_trials)
          == 16
      )
      # at least 4 trials in rung 2 (#batches = 500)
      assert (
          sum(t.totalBatchesProcessed >= 500 for t in response_trials)
          >= 4
      )
      # at least 1 trial in rung 3 (#batches = 2000)
      assert (
          sum(t.totalBatchesProcessed == 2000 for t in response_trials)
          >= 1
      )
  
      ok = True
      for trial in response_trials:
          ok = ok and check_trial_state(
              trial, bindings.trialv1State.COMPLETED
          )
      assert ok, "some trials failed"
  
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 8 for calling a global function with example usage: test_run_asha_batches_exp(tmp_path, client_login) without return types