class_docstr: ``LocalSearchRunner`` performs a search for optimal hyperparameter values,
  applying the provided ``SearchMethod``. It is executed locally and interacts
  with a Determined cluster where it starts a multi-trial experiment. It then
  reacts to event notifications coming from the running experiments by forwarding
  them to event handler methods in your ``SearchMethod`` implementation and sending
  the returned operations back to the experiment.
class_docstr_tok: ["``","LocalSearchRunner","``","performs","a","search","for","optimal","hyperparameter","values",",","applying","the","provided","``","SearchMethod","``",".","It","is","executed","locally","and","interacts","with","a","Determined","cluster","where","it","starts","a","multi-trial","experiment",".","It","then","reacts","to","event","notifications","coming","from","the","running","experiments","by","forwarding","them","to","event","handler","methods","in","your","``","SearchMethod","``","implementation","and","sending","the","returned","operations","back","to","the","experiment","."]
docstr: Run custom search.
  
  Args:
      exp_config (dictionary, string): experiment config filename (.yaml) or a dict.
      model_dir (string): directory containing model definition.
      includes (Iterable[Union[str, pathlib.Path]], optional): Additional files
          or directories to include in the model definition.  (default: ``None``)
docstr_tok: ["Run","custom","search",".","Args",":","exp_config","(","dictionary",",","string",")",":","experiment","config","filename","(",".yaml",")","or","a","dict",".","model_dir","(","string",")",":","directory","containing","model","definition",".","includes","(","Iterable","[","Union","[","str",",","pathlib.Path","]","]",",","optional",")",":","Additional","files","or","directories","to","include","in","the","model","definition",".","(","default",":","``","None","``",")"]
code: def run(
      self,
      exp_config: Union[Dict[str, Any], str],
      model_dir: Optional[str] = None,
      includes: Optional[Iterable[Union[str, Path]]] = None,
  ) -> int:
      """
      Run custom search.
  
      Args:
          exp_config (dictionary, string): experiment config filename (.yaml) or a dict.
          model_dir (string): directory containing model definition.
          includes (Iterable[Union[str, pathlib.Path]], optional): Additional files
              or directories to include in the model definition.  (default: ``None``)
      """
      logger.info("LocalSearchRunner.run")
  
      if model_dir is None:
          model_dir = os.getcwd()
      experiment_id_file = self.searcher_dir.joinpath(
          EXPERIMENT_ID_FILE
      )
      operations: Optional[List[searcher.Operation]] = None
      if experiment_id_file.exists():
          with experiment_id_file.open("r") as f:
              experiment_id = int(f.read())
          logger.info(
              f"Resuming HP searcher for experiment {experiment_id}"
          )
          # load searcher state and search method state
          _, operations = self.load_state(experiment_id)
      else:
          exp = client.create_experiment(
              exp_config, model_dir, includes
          )
          with experiment_id_file.open("w") as f:
              f.write(str(exp.id))
          state_path = self._get_state_path(exp.id)
          state_path.mkdir(parents=True)
          self.state.experiment_id = exp.id
          self.state.last_event_id = 0
          self.save_state(exp.id, [])
          experiment_id = exp.id
          # Note: Simulating the same print functionality as our CLI when making an experiment.
          logger.info(f"Created experiment {experiment_id}")
  
      # make sure client is initialized
      # TODO: remove typing suppression when mypy #14473 is resolved
      client._require_singleton(lambda: None)()  # type: ignore
      assert client._determined is not None
      session = client._determined._session
      self.run_experiment(experiment_id, session, operations)
      return experiment_id
  
imports: import json
  import logging
  import os
  import pickle
  import time
  import uuid
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
  from determined import searcher
  from determined.common.api import bindings, errors
  from determined.experimental import client
label_desc: Use image node_id 2 for calling the LocalSearchRunner obj's underlying member method code with example usage: obj.run(exp_config, model_dir, includes) and returns: experiment_id