code: def _test_create_blobs_queue_db(self, add_blobs_fun):
      device_opt = core.DeviceOption(caffe2_pb2.IDEEP, 0)
      with core.DeviceScope(device_opt):
          num_samples = 10000
          batch_size = 10
          init_net = core.Net("init_net")
          net = core.Net("test_create_blobs_queue_db")
          queue = init_net.CreateBlobsQueue(
              [], "queue", capacity=num_samples
          )
          reader = init_net.CreateBlobsQueueDB(
              [queue],
              "blobs_queue_db_reader",
              value_blob_index=0,
              timeout_secs=0.1,
          )
          workspace.RunNetOnce(init_net)
          add_blobs_fun(queue, num_samples)
  
          net.TensorProtosDBInput(
              [reader], ["image", "label"], batch_size=batch_size
          )
          workspace.CreateNet(net)
  
          close_net = core.Net("close_net")
          close_net.CloseBlobsQueue([queue], [])
  
          for i in range(int(num_samples / batch_size)):
              with timeout_guard.CompleteInTimeOrDie(2.0):
                  workspace.RunNet(net)
  
              images = workspace.FetchBlob("image")
              labels = workspace.FetchBlob("label")
              self.assertEqual(batch_size, len(images))
              self.assertEqual(batch_size, len(labels))
              for idx, item in enumerate(images):
                  self.assertEqual(
                      "foo{}".format(i * batch_size + idx).encode(
                          "utf-8"
                      ),
                      item,
                  )
              for item in labels:
                  self.assertEqual(1, item)
          workspace.RunNetOnce(close_net)
  
file_path: pytorch/caffe2/python/ideep/blobs_queue_db_test.py
imports: import unittest
  import numpy
  import caffe2.proto.caffe2_pb2
  from caffe2.python import core, workspace, timeout_guard
label_desc: Use image node_id 3 for calling the BlobsQueueDBTest obj's underlying member method code with example usage: obj._test_create_blobs_queue_db(add_blobs_fun) without return types