code: def __iter_indices_per_workers__(
      self,
      indices_per_workers: List[List[List[Union[int, ChunkedIndex]]]],
  ) -> Iterator[List[Union[int, ChunkedIndex]]]:
      batches: List[List[Union[int, ChunkedIndex]]] = []
      counter = 0
      while sum([len(v) for v in indices_per_workers]) != 0:
          worker_indices = indices_per_workers[
              counter % self._num_workers
          ]
          if len(worker_indices) == 0:
              batches.append([])
          else:
              batches.append(worker_indices.pop(0))
          counter += 1
  
      while True:
          if len(batches[-1]) == 0:
              batches.pop(-1)
          else:
              break
  
      yield from batches
  
file_path: pytorch-lightning/src/lightning/data/streaming/sampler.py
imports: import logging
  from dataclasses import dataclass
  from typing import Any, Dict, Iterator, List, Optional, Union
  import numpy
label_desc: Use image node_id 10 for calling the CacheBatchSampler obj's underlying member method code with example usage: obj.__iter_indices_per_workers__(indices_per_workers) without return types