code: def test_streaming_metrics_api() -> None:
      # TODO: refactor tests to not use cli singleton auth.
      certs.cli_cert = certs.default_load(conf.make_master_url())
      authentication.cli_auth = authentication.Authentication(
          conf.make_master_url()
      )
  
      pool = mp.pool.ThreadPool(processes=7)
  
      experiment_id = exp.create_experiment(
          conf.fixtures_path("mnist_pytorch/adaptive_short.yaml"),
          conf.tutorials_path("mnist_pytorch"),
      )
      # To fully test the streaming APIs, the requests need to start running immediately after the
      # experiment, and then stay open until the experiment is complete. To accomplish this with all
      # of the API calls on a single experiment, we spawn them all in threads.
  
      # The HP importance portion of this test is commented out until the feature is enabled by
      # default
  
      metric_names_thread = pool.apply_async(
          request_metric_names, (experiment_id,)
      )
      train_metric_batches_thread = pool.apply_async(
          request_train_metric_batches, (experiment_id,)
      )
      valid_metric_batches_thread = pool.apply_async(
          request_valid_metric_batches, (experiment_id,)
      )
      train_trials_snapshot_thread = pool.apply_async(
          request_train_trials_snapshot, (experiment_id,)
      )
      valid_trials_snapshot_thread = pool.apply_async(
          request_valid_trials_snapshot, (experiment_id,)
      )
      train_trials_sample_thread = pool.apply_async(
          request_train_trials_sample, (experiment_id,)
      )
      valid_trials_sample_thread = pool.apply_async(
          request_valid_trials_sample, (experiment_id,)
      )
  
      metric_names_results = metric_names_thread.get()
      train_metric_batches_results = train_metric_batches_thread.get()
      valid_metric_batches_results = valid_metric_batches_thread.get()
      train_trials_snapshot_results = train_trials_snapshot_thread.get()
      valid_trials_snapshot_results = valid_trials_snapshot_thread.get()
      train_trials_sample_results = train_trials_sample_thread.get()
      valid_trials_sample_results = valid_trials_sample_thread.get()
  
      if metric_names_results is not None:
          pytest.fail(
              "metric-names: %s. Results: %s" % metric_names_results
          )
      if train_metric_batches_results is not None:
          pytest.fail(
              "metric-batches (training): %s. Results: %s"
              % train_metric_batches_results
          )
      if valid_metric_batches_results is not None:
          pytest.fail(
              "metric-batches (validation): %s. Results: %s"
              % valid_metric_batches_results
          )
      if train_trials_snapshot_results is not None:
          pytest.fail(
              "trials-snapshot (training): %s. Results: %s"
              % train_trials_snapshot_results
          )
      if valid_trials_snapshot_results is not None:
          pytest.fail(
              "trials-snapshot (validation): %s. Results: %s"
              % valid_trials_snapshot_results
          )
      if train_trials_sample_results is not None:
          pytest.fail(
              "trials-sample (training): %s. Results: %s"
              % train_trials_sample_results
          )
      if valid_trials_sample_results is not None:
          pytest.fail(
              "trials-sample (validation): %s. Results: %s"
              % valid_trials_sample_results
          )
  
imports: import json
  import multiprocessing
  import multiprocessing.pool
  import subprocess
  from typing import Dict, List, Set, Union
  import pytest
  from determined.common import api
  from determined.common.api import authentication, bindings, certs
  from tests import api_utils
  from tests import config
  from tests import experiment
label_desc: Use image node_id 1 for calling a global function with example usage: test_streaming_metrics_api() without return types