class_docstr: Synchronous abstraction for tracking requests.
class_docstr_tok: ["Synchronous","abstraction","for","tracking","requests","."]
docstr: Get the new requests and finished requests to be
  sent to the engine.
docstr_tok: ["Get","the","new","requests","and","finished","requests","to","be","sent","to","the","engine","."]
code: def get_new_and_finished_requests(
      self,
  ) -> Tuple[List[dict], Set[str]]:
      """Get the new requests and finished requests to be
      sent to the engine."""
      new_requests: List[dict] = []
      finished_requests: Set[str] = set()
  
      while not self._finished_requests.empty():
          request_id = self._finished_requests.get_nowait()
          finished_requests.add(request_id)
          self._request_streams.pop(request_id, None)
  
      while not self._new_requests.empty():
          stream, new_request = self._new_requests.get_nowait()
          if stream.request_id in finished_requests:
              # The request has already been aborted.
              stream.finish()
              continue
          self._request_streams[stream.request_id] = stream
          new_requests.append(new_request)
  
      self.new_requests_event.clear()
  
      return new_requests, finished_requests
  
imports: import asyncio
  import time
  from functools import partial
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
  from bigdl.llm.vllm.config import ModelConfig
  from bigdl.llm.vllm.engine.arg_utils import AsyncEngineArgs
  from bigdl.llm.vllm.engine.llm_engine import LLMEngine
  from bigdl.llm.vllm.logger import init_logger
  from bigdl.llm.vllm.outputs import RequestOutput
  from bigdl.llm.vllm.sampling_params import SamplingParams
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 8 for calling the RequestTracker obj's underlying member method code with example usage: obj.get_new_and_finished_requests() and returns: new_requests,  finished_requests