code: def test_customized_sampler_dataloader(inherit):
      try:
          logger.set_stdout("raw", level="info")
          # 需要检验一下 set_dist_repro_dataloader 是否可以在定制 batch_sampler 的情况下正确运行
          num_samples = 10
          dataset = OneflowNormalXYDataset(num_samples)
          if inherit:
  
              class Sampler(oneflow.utils.data.RandomSampler):
                  def __init__(self, dataset, batch_size):
                      self.dataset = dataset
                      self.batch_size = batch_size
  
                  def __iter__(self):
                      indices = list(range(len(dataset)))
                      return iter(indices)
  
                  def __len__(self):
                      return len(self.dataset)
  
          else:
  
              class Sampler:
                  def __init__(self, dataset, batch_size):
                      self.dataset = dataset
                      self.batch_size = batch_size
  
                  def __iter__(self):
                      indices = list(range(len(dataset)))
                      return iter(indices)
  
                  def __len__(self):
                      return len(self.dataset)
  
          dl = prepare_oneflow_dataloader(
              dataset, sampler=Sampler(dataset, batch_size=4)
          )
          model = OneflowNormalModel_Classification_1(10, 32)
          device = [oneflow.device("cuda", i) for i in [0, 1]]
          driver = OneflowDDPDriver(model, parallel_device=device)
          driver.setup()
          # TODO 这里需要raise
          with pytest.raises(TypeError):
              dl = driver.set_dist_repro_dataloader(
                  dataloader=dl, dist="dist", reproducible=False
              )
      finally:
          pass
  
imports: import os
  import sys
  import pytest
  from pathlib import Path
  from fastNLP.core.drivers.oneflow_driver.ddp import OneflowDDPDriver
  from fastNLP import prepare_oneflow_dataloader
  from fastNLP.core.samplers import RandomSampler, UnrepeatedSampler, BucketedBatchSampler, UnrepeatedRandomSampler, UnrepeatedSequentialSampler
  from tests.helpers.models.oneflow_model import OneflowNormalModel_Classification_1
  from tests.helpers.datasets.oneflow_data import OneflowNormalDataset, OneflowNormalXYDataset
  from tests.helpers.utils import recover_logger
  from fastNLP.envs.distributed import rank_zero_rm
  from fastNLP import logger
  from fastNLP.core.drivers.oneflow_driver.dist_utils import fastnlp_oneflow_all_gather
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW
label_desc: Use image node_id 7 for calling a global function with example usage: test_customized_sampler_dataloader(inherit) and returns: iter, len, iter, len