code: def test_base_monitor_shutdown(mocked_client):
      class MockObj:
          pass
  
      class MockMonitor(BaseMonitor):
          def __init__(
              self,
              api: Api,
              dataset: str,
          ):
              super().__init__(
                  MockObj(),
                  api=api,
                  dataset=dataset,
                  log_interval=10,  # large time
              )
              self.records_sent = 0
  
          def _prepare_log_data(
              self, data: List[str]
          ) -> Dict[str, Any]:
              return {
                  "name": self.dataset,
                  "records": [
                      TextClassificationRecord(text=text)
                      for text in data
                  ],
              }
  
      dataset = "test_base_monitor_shutdown"
      api = active_api()
      expected_number_of_records = 512
      monitor = MockMonitor(
          api=api,
          dataset=dataset,
      )
  
      api.delete(dataset)
      monitor.send_records(
          data=["this is a text"] * expected_number_of_records
      )
      monitor.shutdown()
      assert len(monitor._consumers) == 1
      for consumer in monitor._consumers.values():
          assert consumer.queue.unfinished_tasks == 0
  
      sleep(1)  # wait for refresh
      ds = api.load(dataset)
      assert len(ds) == expected_number_of_records
  
imports: from time import sleep
  from typing import Any, Dict, List
  from argilla.client.api import Api
  from argilla.client.models import TextClassificationRecord
  from argilla.client.singleton import active_api
  from argilla.monitoring.base import BaseMonitor
label_desc: Use image node_id 1 for calling a global function with example usage: test_base_monitor_shutdown(mocked_client) and returns: dict