code: def test_manual_system_metrics_monitor():
      with mlflow.start_run(log_system_metrics=False) as run:
          system_monitor = SystemMetricsMonitor(
              run.info.run_id,
              sampling_interval=0.1,
              samples_before_logging=2,
          )
          system_monitor.start()
          thread_names = [
              thread.name for thread in threading.enumerate()
          ]
          # Check the system metrics monitoring thread has been started.
          assert "SystemMetricsMonitor" in thread_names
  
          time.sleep(2)
      # Pause for a bit to allow the system metrics monitoring to exit.
      time.sleep(1)
      thread_names = [thread.name for thread in threading.enumerate()]
      # Check the system metrics monitoring thread has exited.
      assert "SystemMetricsMonitor" not in thread_names
  
      mlflow_run = mlflow.get_run(run.info.run_id)
      metrics = mlflow_run.data.metrics
  
      expected_metrics_name = [
          "cpu_utilization_percentage",
          "system_memory_usage_megabytes",
          "disk_usage_percentage",
          "disk_usage_megabytes",
          "disk_available_megabytes",
          "network_receive_megabytes",
          "network_transmit_megabytes",
      ]
      expected_metrics_name = [
          f"system/{name}" for name in expected_metrics_name
      ]
      for name in expected_metrics_name:
          assert name in metrics
  
      # Check the step is correctly logged.
      metrics_history = mlflow.MlflowClient().get_metric_history(
          run.info.run_id, "system/cpu_utilization_percentage"
      )
      assert metrics_history[-1].step > 0
  
file_path: mlflow/tests/system_metrics/test_system_metrics_logging.py
imports: import threading
  import time
  import pytest
  import mlflow
  from mlflow.system_metrics.system_metrics_monitor import SystemMetricsMonitor
label_desc: Use image node_id 2 for calling a global function with example usage: test_manual_system_metrics_monitor() without return types