code: def test_data_parallel_trainer(ray_start_8_cpus):
      num_workers = 2
      trainer = AssertingDataParallelTrainer(
          train_fn,
          scaling_config=ScalingConfig(
              num_workers=num_workers, placement_strategy="SPREAD"
          ),
      )
      tuner = Tuner(
          trainer,
          param_space={
              "train_loop_config": {
                  "num_epochs": 100,
                  "metric": tune.grid_search([1, 2, 3, 4, 5]),
              }
          },
          tune_config=TuneConfig(
              mode="max",
              metric="metric",
              scheduler=ResourceChangingScheduler(
                  ASHAScheduler(),
                  resources_allocation_function=DistributeResources(
                      add_bundles=True, reserve_resources={"CPU": 1}
                  ),
              ),
          ),
          run_config=RunConfig(
              failure_config=FailureConfig(fail_fast=True)
          ),
      )
      result_grid = tuner.fit()
      assert not any(x.error for x in result_grid)
      # + 1 for Trainable
      assert (
          result_grid.get_dataframe()["num_cpus"].max()
          > num_workers + 1
      )
  
imports: import os
  from ray import train
  from ray.train import Checkpoint, FailureConfig, RunConfig, ScalingConfig
  from ray.air.constants import TRAIN_DATASET_KEY
  from ray.tune.tune_config import TuneConfig
  from ray.tune.tuner import Tuner
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train.xgboost import XGBoostTrainer
  from sklearn.datasets import load_breast_cancer
  import pandas
  import pytest
  import ray
  import json
  from tempfile import TemporaryDirectory
  from ray import tune
  from ray.tune.schedulers.resource_changing_scheduler import DistributeResources, ResourceChangingScheduler
  from ray.tune.schedulers.async_hyperband import ASHAScheduler
label_desc: Use image node_id 3 for calling a global function with example usage: test_data_parallel_trainer(ray_start_8_cpus) without return types