code: def request_metric_names(experiment_id):  # type: ignore
      response = api.get(
          conf.make_master_url(),
          "api/v1/experiments/metrics-stream/metric-names?ids={}".format(
              experiment_id
          ),
          params={"period_seconds": 1},
      )
      results = [
          message["result"]
          for message in map(json.loads, response.text.splitlines())
      ]
  
      # First let's verify an empty response was sent back before any real work was done
      if results[0]["searcherMetrics"][0] != "validation_loss":
          return (
              "unexpected searcher metric in first response",
              results,
          )
      if results[0]["trainingMetrics"] != []:
          return (
              "unexpected training metric in first response",
              results,
          )
      if results[0]["validationMetrics"] != []:
          return (
              "unexpected validation metric in first response",
              results,
          )
  
      # Then we verify that all expected responses are eventually received exactly once
      accumulated_training = set()
      accumulated_validation = set()
      for i in range(1, len(results)):
          for training in results[i]["trainingMetrics"]:
              if training in accumulated_training:
                  return ("training metric appeared twice", results)
              accumulated_training.add(training)
          for validation in results[i]["validationMetrics"]:
              if validation in accumulated_validation:
                  return ("training metric appeared twice", results)
              accumulated_validation.add(validation)
  
      if accumulated_training != {"loss"}:
          return ("unexpected set of training metrics", results)
      if accumulated_validation != {"validation_loss", "accuracy"}:
          return ("unexpected set of validation metrics", results)
      return None
  
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 2 for calling a global function with example usage: request_metric_names(experiment_id) and returns: None, str,  results, str,  results, str,  results, str,  results, str,  results, str,  results, str,  results