code: def test_tune(ray_start_8_cpus):
      train_dataset = ray.data.from_pandas(train_df)
      valid_dataset = ray.data.from_pandas(test_df)
      trainer = XGBoostTrainer(
          scaling_config=scale_config,
          label_column="target",
          params={**params, **{"max_depth": 1}},
          datasets={
              TRAIN_DATASET_KEY: train_dataset,
              "valid": valid_dataset,
          },
      )
  
      tune.run(
          trainer.as_trainable(),
          config={"params": {"max_depth": tune.randint(2, 4)}},
          num_samples=2,
      )
  
      # Make sure original Trainer is not affected.
      assert trainer.params["max_depth"] == 1
  
imports: import json
  import pandas
  import pytest
  import xgboost
  from sklearn.datasets import load_breast_cancer
  from sklearn.model_selection import train_test_split
  import ray
  from ray import train, tune
  from ray.train import ScalingConfig
  from ray.train.constants import TRAIN_DATASET_KEY
  from ray.train.xgboost import XGBoostTrainer
label_desc: Use image node_id 8 for calling a global function with example usage: test_tune(ray_start_8_cpus) without return types