code: def test_dcgm(
      wandb_init,
      relay_server,
      test_settings,
      filters,
      expected_keys,
      unexpected_keys,
  ):
      with mock.patch.object(
          wandb.sdk.internal.system.assets.open_metrics.requests.Session,
          "get",
          mocked_requests_get,
      ), relay_server() as relay:
          run = wandb_init(
              project="stability",
              settings=test_settings(
                  dict(
                      _stats_sample_rate_seconds=1,
                      _stats_samples_to_average=1,
                      # listen to the same endpoint for both "nodes"
                      _stats_open_metrics_endpoints={
                          "node1": "http://localhost:9400/metrics",
                          "node2": "http://localhost:9400/metrics",
                      },
                      _stats_open_metrics_filters=filters,
                  )
              ),
          )
  
          # Wait for the first metrics to be logged
          # If there's an issue, the test will eventually time out and fail
          i = 0
          while not len(
              relay.context.get_file_contents("wandb-events.jsonl")
          ):
              run.log({"junk": i})
              time.sleep(1)
              i += 1
          run.finish()
  
          logged_system_metric_keys = (
              relay.context.events.columns.values
          )
  
          assert all(
              key in logged_system_metric_keys for key in expected_keys
          )
          assert all(
              key not in logged_system_metric_keys
              for key in unexpected_keys
          )
  
file_path: wandb/tests/pytest_tests/system_tests/test_system_metrics/test_open_metrics.py
imports: import random
  import time
  from typing import Union
  from unittest import mock
  import pytest
  import wandb
label_desc: Use image node_id 4 for calling a global function with example usage: test_dcgm(wandb_init, relay_server, test_settings, filters, expected_keys, unexpected_keys) without return types