code: def generate_new_batch(self, current_batch: Batch = None):
      if (
          current_batch is not None
          and len(current_batch.reqs) >= self.running_max_req_size
      ):
          return None
      self._init_cache_list(current_batch)
      can_run_list = []
      new_batch_total_tokens = 0
      aborted_count = 0
      for req in self.waiting_req_list:
          flag = self._can_add_new_req(req)
          if req.aborted:
              aborted_count += 1
              continue
          if (
              flag
              and new_batch_total_tokens + req.input_len
              <= self.batch_max_tokens
          ):
              can_run_list.append(req)
              new_batch_total_tokens += req.input_len
          else:
              break
  
      if len(can_run_list) != 0:
          new_batch = Batch(uuid.uuid4().hex, can_run_list)
          self.waiting_req_list = self.waiting_req_list[
              len(can_run_list) + aborted_count :
          ]
          return new_batch
      else:
          return None
  
file_path: ColossalAI/colossalai/legacy/inference/dynamic_batching/req_queue.py
imports: import uuid
  from typing import List
  import numpy
  from .io_struct import Batch, Req
label_desc: Use image node_id 5 for calling the ReqQueue obj's underlying member method code with example usage: obj.generate_new_batch(current_batch) and returns: None, new_batch, None