class_docstr: This will preoritically query data from cache-service
class_docstr_tok: ["This","will","preoritically","query","data","from","cache-service"]
code: def fetch_data(self):
      while not self.stop_event.is_set():
          response = requests.get(
              f"{self.cache_svc_url}/",
              params={
                  "table_name": self.table_name,
                  "name_space": self.name_space,
              },
          )
  
          if response.status_code == 200:
              batch = response.json()
  
              # in trianing, we use iteraiton-per-epoch to control the end
              if batch == self.end_signal:
                  if self.name_space == "valid":
                      # end_signal in inference, stop !
                      logger.info(
                          "[StreamingDataLoader]: last iteration in valid is meet!"
                      )
                      self.data_queue.put({self.end_signal: True})
                  else:
                      # end_signal in trianing, then keep training
                      continue
              else:
                  import torch
  
                  # convert to tensor again
                  id_tensor = torch.LongTensor(batch["id"])
                  value_tensor = torch.FloatTensor(batch["value"])
                  y_tensor = torch.FloatTensor(batch["y"])
                  data_tensor = {
                      "id": id_tensor,
                      "value": value_tensor,
                      "y": y_tensor,
                  }
                  self.data_queue.put(data_tensor)
          else:
              print(response.json())
              time.sleep(5)
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/dataset_utils/sequence_dataloader.py
imports: import queue
  import threading
  import requests
  import time
  from src.logger import logger
label_desc: Use image node_id 2 for calling the SquenceDataLoader obj's underlying member method code with example usage: obj.fetch_data() without return types