code: def fetch_data(self):
      with psycopg2.connect(
          database=self.database, user=USER, host=HOST, port=PORT
      ) as conn:
          while True:
              try:
                  # fetch and preprocess data from PostgreSQL
                  batch, time_usg = self.fetch_and_preprocess(conn)
                  self.queue.put(batch)
                  print(
                      f"Data is fetched, {self.name_space} queue_size={self.queue.qsize()}, time_usg={time_usg}"
                  )
                  logger.info(
                      f"Data is fetched, queue_size={self.queue.qsize()}, time_usg={time_usg}"
                  )
                  # block until a free slot is available
                  time.sleep(0.1)
              except psycopg2.OperationalError:
                  logger.exception(
                      "Lost connection to the database, trying to reconnect..."
                  )
                  time.sleep(
                      5
                  )  # wait before trying to establish a new connection
                  conn = psycopg2.connect(
                      database=self.database,
                      user=USER,
                      host=HOST,
                      port=PORT,
                  )
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/cache-service/cache_service.py
imports: import time
  import threading
  import queue
  import psycopg2
  from typing import Any, List, Dict, Tuple
  from sanic import Sanic
  from sanic.response import json
  import calendar
  import os
  import logging
label_desc: Use image node_id 4 for calling the CacheService obj's underlying member method code with example usage: obj.fetch_data() without return types