code: def test_gpu_monitor():
      try:
          gpu_monitor = GPUMonitor()
      except Exception:
          # If pynvml is not installed, or there is no GPU, then `gpu_monitor` creation will fail. In
          # this case we skip the test.
          return
  
      gpu_monitor.collect_metrics()
  
      assert isinstance(
          gpu_monitor.metrics["gpu_0_memory_usage_percentage"], list
      )
      assert isinstance(
          gpu_monitor.metrics["gpu_0_memory_usage_megabytes"], list
      )
      assert isinstance(
          gpu_monitor.metrics["gpu_0_utilization_percentage"], list
      )
  
      gpu_monitor.collect_metrics()
      aggregated_metrics = gpu_monitor.aggregate_metrics()
      assert isinstance(
          aggregated_metrics["gpu_0_memory_usage_percentage"], float
      )
      assert isinstance(
          aggregated_metrics["gpu_0_memory_usage_megabytes"], float
      )
      assert isinstance(
          aggregated_metrics["gpu_0_utilization_percentage"], float
      )
  
      gpu_monitor.clear_metrics()
      assert len(gpu_monitor.metrics.keys) == 0
  
imports: from mlflow.system_metrics.metrics.cpu_monitor import CPUMonitor
  from mlflow.system_metrics.metrics.disk_monitor import DiskMonitor
  from mlflow.system_metrics.metrics.gpu_monitor import GPUMonitor
  from mlflow.system_metrics.metrics.network_monitor import NetworkMonitor
label_desc: Use image node_id 2 for calling a global function with example usage: test_gpu_monitor() without return types