class_docstr: Implementation of HpoExecutor Interface, where ray tune is used as the backend
docstr: Execute ray hpo experiment
  
  Parameters
  ----------
  model_trial: Callable
      A function conducting individual trial
  train_fn_kwargs: dict
      A dict containing kwargs passed to model_trial
  directory: str
      Directory to save ray tune results. Ray will write artifacts to directory/trial_dir/
      While HPO, ray will chdir to this directory. Therefore, it's important to provide dataset or model saving path as absolute path.
      After HPO, we change back to the original working directory.
  minimum_cpu_per_trial: int
      Minimum number of cpu required to perform a trial. Must be >= 1
  minimum_gpu_per_trial: float
      Minimum number of gpu required to perform a trial. You are allowed to provide fractional gpu with a float.
      If not needed, provide 0
  adapter_type: str
      Type of adapter used by ray hpo experiment.
      Adapters are used to provide custom info or behavior that's module specific to the ray hpo experiment.
      For more info, please refer to `autogluon/core/hpo/ray_hpo`
      Valid values are ['tabular', 'timeseries', 'automm']
  trainable_is_parallel
      Whether the trainable itself will use ray to run parallel job or not.
  tune_config_kwargs
      Additional args being passed to tune.TuneConfig https://docs.ray.io/en/latest/ray-air/package-ref.html#ray.tune.tune_config.TuneConfig
  run_config_kwargs
      Additional args being passed to air.RunConfig https://docs.ray.io/en/latest/ray-air/package-ref.html#ray.air.config.RunConfig
docstr_tok: ["Execute","ray","hpo","experiment","Parameters","--","--","--","--","--","model_trial",":","Callable","A","function","conducting","individual","trial","train_fn_kwargs",":","dict","A","dict","containing","kwargs","passed","to","model_trial","directory",":","str","Directory","to","save","ray","tune","results",".","Ray","will","write","artifacts","to","directory\/trial_dir\/","While","HPO",",","ray","will","chdir","to","this","directory",".","Therefore",",","it","'s","important","to","provide","dataset","or","model","saving","path","as","absolute","path",".","After","HPO",",","we","change","back","to","the","original","working","directory",".","minimum_cpu_per_trial",":","int","Minimum","number","of","cpu","required","to","perform","a","trial",".","Must","be",">","=","1","minimum_gpu_per_trial",":","float","Minimum","number","of","gpu","required","to","perform","a","trial",".","You","are","allowed","to","provide","fractional","gpu","with","a","float",".","If","not","needed",",","provide","0","adapter_type",":","str","Type","of","adapter","used","by","ray","hpo","experiment",".","Adapters","are","used","to","provide","custom","info","or","behavior","that","'s","module","specific","to","the","ray","hpo","experiment",".","For","more","info",",","please","refer","to","`","autogluon\/core\/hpo\/ray_hpo","`","Valid","values","are","[","'tabular","'",",","'timeseries","'",",","'automm","'","]","trainable_is_parallel","Whether","the","trainable","itself","will","use","ray","to","run","parallel","job","or","not",".","tune_config_kwargs","Additional","args","being","passed","to","tune.TuneConfig","https",":","\/\/docs.ray.io\/en\/latest\/ray-air\/package-ref.html","#","ray.tune.tune_config.TuneConfig","run_config_kwargs","Additional","args","being","passed","to","air.RunConfig","https",":","\/\/docs.ray.io\/en\/latest\/ray-air\/package-ref.html","#","ray.air.config.RunConfig"]
code: def execute(
      self,
      *,  # Force kwargs to avoid bugs
      model_trial: Callable,
      train_fn_kwargs: dict,
      directory: str,
      minimum_cpu_per_trial: int,
      minimum_gpu_per_trial: float,
      model_estimate_memory_usage: float,
      adapter_type: str,
      trainable_is_parallel: bool = False,
      tune_config_kwargs: Optional[Dict[str, Any]] = None,
      run_config_kwargs: Optional[Dict[str, Any]] = None,
  ):
      """
      Execute ray hpo experiment
  
      Parameters
      ----------
      model_trial: Callable
          A function conducting individual trial
      train_fn_kwargs: dict
          A dict containing kwargs passed to model_trial
      directory: str
          Directory to save ray tune results. Ray will write artifacts to directory/trial_dir/
          While HPO, ray will chdir to this directory. Therefore, it's important to provide dataset or model saving path as absolute path.
          After HPO, we change back to the original working directory.
      minimum_cpu_per_trial: int
          Minimum number of cpu required to perform a trial. Must be >= 1
      minimum_gpu_per_trial: float
          Minimum number of gpu required to perform a trial. You are allowed to provide fractional gpu with a float.
          If not needed, provide 0
      adapter_type: str
          Type of adapter used by ray hpo experiment.
          Adapters are used to provide custom info or behavior that's module specific to the ray hpo experiment.
          For more info, please refer to `autogluon/core/hpo/ray_hpo`
          Valid values are ['tabular', 'timeseries', 'automm']
      trainable_is_parallel
          Whether the trainable itself will use ray to run parallel job or not.
      tune_config_kwargs
          Additional args being passed to tune.TuneConfig https://docs.ray.io/en/latest/ray-air/package-ref.html#ray.tune.tune_config.TuneConfig
      run_config_kwargs
          Additional args being passed to air.RunConfig https://docs.ray.io/en/latest/ray-air/package-ref.html#ray.air.config.RunConfig
      """
      from .ray_hpo import RayTuneAdapterFactory, run
  
      # Disable tensorboard logging to avoid layer warning
      # TODO: remove this when ray tune fix ray tune pass tuple to hyperopt issue
      os.environ["TUNE_DISABLE_AUTO_CALLBACK_LOGGERS"] = "1"
      analysis = run(
          trainable=model_trial,
          trainable_args=train_fn_kwargs,
          search_space=self.search_space,
          hyperparameter_tune_kwargs=self.hyperparameter_tune_kwargs,
          metric="validation_performance",
          mode="max",
          save_dir=directory,
          ray_tune_adapter=RayTuneAdapterFactory.get_adapter(
              adapter_type
          )(),
          trainable_is_parallel=trainable_is_parallel,
          total_resources=self.resources,
          minimum_cpu_per_trial=minimum_cpu_per_trial,
          minimum_gpu_per_trial=minimum_gpu_per_trial,
          model_estimate_memory_usage=model_estimate_memory_usage,
          time_budget_s=self.time_limit,
          verbose=0,
          tune_config_kwargs=tune_config_kwargs,
          run_config_kwargs=run_config_kwargs,
      )
      os.environ.pop("TUNE_DISABLE_AUTO_CALLBACK_LOGGERS", None)
      self.analysis = analysis
  
imports: from __future__ import annotations
  import copy
  import logging
  import math
  import os
  import time
  from abc import ABC, abstractmethod
  from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
  import pandas
  from autogluon.common import space
  from autogluon.common.utils.resource_utils import ResourceManager
  from autogluon.common.utils.s3_utils import is_s3_url
  from ..ray.resources_calculator import ResourceCalculator
  from ..scheduler.scheduler_factory import scheduler_factory
  from ..utils.savers import save_pkl
  from .constants import CUSTOM_BACKEND, RAY_BACKEND
  from .exceptions import EmptySearchSpace
label_desc: Use image node_id 5 for calling the RayHpoExecutor obj's underlying member method code with example usage: obj.execute() without return types