code: def test_hpo_and_bagging_valid_resources_per_trial_and_no_resources_per_fold(
      mock_system_resources_ctx_mgr, executor_cls
  ):
      hyperparameter_tune_kwargs = {
          "scheduler": "local",
          "searcher": "random",
          "num_trials": 2,
      }
      # Test valid resources per trial and no resources per fold
      executor = _initialize_executor(
          executor_cls, hyperparameter_tune_kwargs
      )
      total_resources = {"num_cpus": 8, "num_gpus": 1}
      with mock_system_resources_ctx_mgr(
          num_cpus=total_resources["num_cpus"],
          num_gpus=total_resources["num_gpus"],
      ):
          base_model = DummyModel(
              minimum_resources={"num_cpus": 1, "num_gpus": 0.1},
          )
          base_model.initialize()
          bagged_model = DummyBaggedModel(
              model_base=base_model,
              hyperparameters={
                  "ag_args_fit": {"num_cpus": 1, "num_gpus": 0.1}
              },
          )
          bagged_model.initialize()
          executor.register_resources(
              bagged_model, k_fold=8, X=dummy_x, **total_resources
          )
          # 1 bag in parallel, 1 fold in parallel per bagged ensemble, using 1 cpu and 0.1 gpus
          assert executor.hyperparameter_tune_kwargs[
              "resources_per_trial"
          ] == {"num_cpus": 1, "num_gpus": 0.1}
  
imports: import pandas
  import pytest
  from autogluon.core.hpo.executors import CustomHpoExecutor, RayHpoExecutor
  from autogluon.core.models.ensemble.bagged_ensemble_model import BaggedEnsembleModel
  from autogluon.tabular.models import AbstractModel
label_desc: Use image node_id 8 for calling a global function with example usage: test_hpo_and_bagging_valid_resources_per_trial_and_no_resources_per_fold(mock_system_resources_ctx_mgr, executor_cls) without return types