code: def _fetching_results(
      result: Result,
      command_runner: CommandRunner,
      artifact_path: Optional[str],
      smoke_test: bool,
      start_time_unix: int,
  ) -> Tuple[dict, Exception]:
      fetch_result_exception = None
      try:
          command_results = command_runner.fetch_results()
      except Exception as e:
          logger.exception(
              f"Could not fetch results for test command: {e}"
          )
          command_results = {}
          fetch_result_exception = e
  
      if artifact_path:
          try:
              command_runner.fetch_artifact()
          except Exception as e:
              logger.error("Could not fetch artifact for test command")
              logger.exception(e)
  
      # Postprocess result:
      if "last_update" in command_results:
          command_results[
              "last_update_diff"
          ] = time.time() - command_results.get("last_update", 0.0)
  
      try:
          # Logic duplicated in ray_release/command_runner/_anyscale_job_wrapper.py
          # Timeout is the time the test took divided by 200
          # (~7 minutes for a 24h test) but no less than 30s
          # and no more than 900s
          metrics_timeout = max(
              30, min((time.time() - start_time_unix) / 200, 900)
          )
          command_runner.save_metrics(
              start_time_unix, timeout=metrics_timeout
          )
          metrics = command_runner.fetch_metrics()
      except Exception as e:
          logger.exception(
              f"Could not fetch metrics for test command: {e}"
          )
          metrics = {}
  
      if smoke_test:
          command_results["smoke_test"] = True
  
      result.results = command_results
      result.status = ResultStatus.SUCCESS.value
  
      return metrics, fetch_result_exception
  
imports: import os
  import time
  import traceback
  from typing import Optional, List, Tuple
  from ray_release.alerts.handle import handle_result, require_result
  from ray_release.anyscale_util import get_cluster_name
  from ray_release.buildkite.output import buildkite_group, buildkite_open_last
  from ray_release.cluster_manager.cluster_manager import ClusterManager
  from ray_release.cluster_manager.full import FullClusterManager
  from ray_release.cluster_manager.minimal import MinimalClusterManager
  from ray_release.command_runner.job_runner import JobRunner
  from ray_release.command_runner.command_runner import CommandRunner
  from ray_release.command_runner.anyscale_job_runner import AnyscaleJobRunner
  from ray_release.test import Test
  from ray_release.config import DEFAULT_BUILD_TIMEOUT, DEFAULT_CLUSTER_TIMEOUT, DEFAULT_COMMAND_TIMEOUT, DEFAULT_WAIT_FOR_NODES_TIMEOUT, RELEASE_PACKAGE_DIR, DEFAULT_AUTOSUSPEND_MINS
  from ray_release.template import load_test_cluster_compute
  from ray_release.exception import ReleaseTestConfigError, ReleaseTestSetupError, CommandError, PrepareCommandError, CommandTimeout, PrepareCommandTimeout, TestCommandError, TestCommandTimeout, ClusterEnvCreateError
  from ray_release.file_manager.job_file_manager import JobFileManager
  from ray_release.logger import logger
  from ray_release.reporter.reporter import Reporter
  from ray_release.result import Result, ResultStatus, handle_exception
  from ray_release.signal_handling import setup_signal_handling, reset_signal_handling, register_handler
label_desc: Use image node_id 7 for calling a global function with example usage: _fetching_results(result, command_runner, artifact_path, smoke_test, start_time_unix) and returns: metrics,  fetch_result_exception