code: def test_hyperopt_scheduler(
      scheduler,
      model_type,
      csv_filename,
      tmpdir,
      ray_cluster_7cpu,
      validate_output_feature=False,
      validation_metric=None,
  ):
      config, rel_path = _setup_ludwig_config(csv_filename, model_type)
  
      hyperopt_config = HYPEROPT_CONFIG.copy()
  
      # finalize hyperopt config settings
      if scheduler == "pb2":
          # setup scheduler hyperparam_bounds parameter
          min = hyperopt_config["parameters"]["trainer.learning_rate"][
              "lower"
          ]
          max = hyperopt_config["parameters"]["trainer.learning_rate"][
              "upper"
          ]
          hyperparam_bounds = {
              "trainer.learning_rate": [min, max],
          }
          hyperopt_config["executor"]["scheduler"] = {
              TYPE: scheduler,
              "hyperparam_bounds": hyperparam_bounds,
          }
      else:
          hyperopt_config["executor"]["scheduler"] = {
              TYPE: scheduler,
          }
  
      if validate_output_feature:
          hyperopt_config["output_feature"] = config[OUTPUT_FEATURES][
              0
          ][NAME]
      if validation_metric:
          hyperopt_config["validation_metric"] = validation_metric
  
      backend = initialize_backend("local")
      update_hyperopt_params_with_defaults(hyperopt_config)
      if hyperopt_config[EXECUTOR].get(MAX_CONCURRENT_TRIALS) == AUTO:
          hyperopt_config[EXECUTOR][
              MAX_CONCURRENT_TRIALS
          ] = backend.max_concurrent_trials(hyperopt_config)
  
      parameters = hyperopt_config["parameters"]
      split = hyperopt_config["split"]
      output_feature = hyperopt_config["output_feature"]
      metric = hyperopt_config["metric"]
      goal = hyperopt_config["goal"]
      executor = hyperopt_config["executor"]
      search_alg = hyperopt_config["search_alg"]
  
      # TODO: Determine if we still need this if-then-else construct
      if search_alg[TYPE] in {""}:
          with pytest.raises(ImportError):
              get_build_hyperopt_executor(RAY)(
                  parameters,
                  output_feature,
                  metric,
                  goal,
                  split,
                  search_alg=search_alg,
                  **executor,
              )
      else:
          hyperopt_executor = get_build_hyperopt_executor(RAY)(
              parameters,
              output_feature,
              metric,
              goal,
              split,
              search_alg=search_alg,
              **executor,
          )
          raytune_results = hyperopt_executor.execute(
              config, dataset=rel_path, output_directory=tmpdir
          )
          assert isinstance(raytune_results, HyperoptResults)
  
imports: import json
  import os
  import os.path
  import uuid
  from typing import Dict, Tuple
  import pytest
  from ludwig.backend import initialize_backend
  from ludwig.constants import ACCURACY, AUTO, BATCH_SIZE, CATEGORY, COMBINER, EXECUTOR, HYPEROPT, INPUT_FEATURES, MAX_CONCURRENT_TRIALS, MODEL_ECD, MODEL_GBM, MODEL_TYPE, NAME, OUTPUT_FEATURES, RAY, TEST, TEXT, TRAINER, TRAINING, TYPE, VALIDATION
  from ludwig.globals import HYPEROPT_STATISTICS_FILE_NAME
  from ludwig.hyperopt.results import HyperoptResults
  from ludwig.hyperopt.run import hyperopt
  from ludwig.hyperopt.utils import update_hyperopt_params_with_defaults
  from ludwig.schema.model_config import ModelConfig
  from ludwig.utils import fs_utils
  from ludwig.utils.data_utils import load_json, use_credentials
  from tests.integration_tests.utils import category_feature, generate_data, minio_test_creds, private_param, remote_tmpdir, text_feature
  from ludwig.hyperopt.execution import get_build_hyperopt_executor, RayTuneExecutor
label_desc: Use image node_id 5 for calling a global function with example usage: test_hyperopt_scheduler(scheduler, model_type, csv_filename, tmpdir, ray_cluster_7cpu, validate_output_feature, validation_metric) without return types