code: def report_json_results(
      core_context: det.core._context.Context,
      op: det.core._searcher.SearcherOperation,
      steps_completed: int,
      add_gpu_info: bool,
      path: Union[str, pathlib.Path],
  ) -> None:
      is_chief = core_context.distributed.rank == 0
      if is_chief:
          with open(path, "r") as f:
              results_dict = json.load(f)
          if add_gpu_info:
              gpu_mem = torch.cuda.get_device_properties(0).total_memory
              results_dict["gpu_mem"] = gpu_mem
          core_context.train.report_validation_metrics(
              steps_completed=steps_completed, metrics=results_dict
          )
          op.report_completed(results_dict)
      # Ensure the operations generator is empty to complete sanity checks.
      try:
          next(core_context.searcher.operations())
      except StopIteration:
          pass
      else:
          raise AssertionError(
              "Unexpected additional operations found!"
          )
  
imports: import argparse
  import copy
  import json
  import logging
  import pathlib
  import random
  from contextlib import contextmanager
  from typing import Any, Dict, Generator, List, Optional, Union
  import filelock
  import torch
  import determined
  from determined.common import util
  from determined.pytorch.dsat import _defaults
  from determined.util import merge_dicts
label_desc: Use image node_id 8 for calling a global function with example usage: report_json_results(core_context, op, steps_completed, add_gpu_info, path) without return types