code: def test_async_logging_queue_pickle():
      run_id = "test_run_id"
      consumer = Consumer()
      async_logging_queue = AsyncLoggingQueue(
          consumer.consume_queue_data
      )
  
      # Pickle the queue without activating it.
      buffer = io.BytesIO()
      pickle.dump(async_logging_queue, buffer)
      deserialized_queue = pickle.loads(
          buffer.getvalue()
      )  # Type: AsyncLoggingQueue
  
      # activate the queue and then try to pickle it
      async_logging_queue.activate()
  
      run_operations = []
      for val in range(0, 10):
          run_operations.append(
              async_logging_queue.log_batch_async(
                  run_id=run_id,
                  metrics=[
                      Metric(
                          "metric", val, timestamp=time.time(), step=1
                      )
                  ],
                  tags=[],
                  params=[],
              )
          )
  
      assert not async_logging_queue._queue.empty()
  
      # Pickle the queue
      buffer = io.BytesIO()
      pickle.dump(async_logging_queue, buffer)
  
      deserialized_queue = pickle.loads(
          buffer.getvalue()
      )  # Type: AsyncLoggingQueue
      assert deserialized_queue._queue.empty()
      assert deserialized_queue._lock is not None
      assert deserialized_queue._is_activated is False
  
      for run_operation in run_operations:
          run_operation.wait()
  
      assert len(consumer.metrics) == 10
  
      # try to log using deserialized queue after activating it.
      deserialized_queue.activate()
      assert deserialized_queue._is_activated
  
      run_operations = []
  
      for val in range(0, 10):
          run_operations.append(
              deserialized_queue.log_batch_async(
                  run_id=run_id,
                  metrics=[
                      Metric(
                          "metric", val, timestamp=time.time(), step=1
                      )
                  ],
                  tags=[],
                  params=[],
              )
          )
  
      for run_operation in run_operations:
          run_operation.wait()
  
      assert (
          len(deserialized_queue._logging_func.__self__.metrics) == 10
      )
  
imports: import io
  import pickle
  import random
  import threading
  import time
  import uuid
  import pytest
  from mlflow import MlflowException
  from mlflow.entities.metric import Metric
  from mlflow.entities.param import Param
  from mlflow.entities.run_tag import RunTag
  from mlflow.utils.async_logging.async_logging_queue import AsyncLoggingQueue
label_desc: Use image node_id 5 for calling a global function with example usage: test_async_logging_queue_pickle() without return types