code: def collect_metrics(time_taken: float) -> bool:
      if "METRICS_OUTPUT_JSON" not in os.environ:
          return False
  
      # Timeout is the time the test took divided by 200
      # (~7 minutes for a 24h test) but no less than 90s
      # and no more than 900s
      metrics_timeout = max(
          90, min((time.time() - time_taken) / 200, 900)
      )
      try:
          subprocess.run(
              [
                  "python",
                  "prometheus_metrics.py",
                  str(time_taken),
                  "--path",
                  os.environ["METRICS_OUTPUT_JSON"],
              ],
              timeout=metrics_timeout,
              check=True,
          )
          return True
      except subprocess.SubprocessError:
          logger.exception("Couldn't collect metrics.")
          return False
  
file_path: ray/release/ray_release/command_runner/_anyscale_job_wrapper.py
imports: import argparse
  import time
  import os
  from pathlib import Path
  import subprocess
  import multiprocessing
  import json
  import sys
  import logging
  from urllib.parse import urlparse
  from typing import Optional, List, Tuple
label_desc: Use image node_id 4 for calling a global function with example usage: collect_metrics(time_taken) and returns: False, True, False