code: def wait_for_run_or_raise(
      process: subprocess.Popen, indicator_file: str, timeout: int = 30
  ):
      print(
          f"Waiting up to {timeout} seconds until trials have been started "
          f"(indicated by existence of `{indicator_file}`)"
      )
  
      timeout = time.monotonic() + timeout
      while (
          process.poll() is None
          and time.monotonic() < timeout
          and not os.path.exists(indicator_file)
      ):
          time.sleep(1)
  
      if not os.path.exists(indicator_file):
          process.terminate()
  
          raise RuntimeError(
              f"Indicator file `{indicator_file}` still doesn't exist, "
              f"indicating that trials have not been started. "
              f"Please check the process output."
          )
  
      print("Process started, trials are running")
  
imports: import argparse
  import csv
  import io
  import tarfile
  from dataclasses import dataclass
  import json
  import os
  import pickle
  import platform
  import re
  import shutil
  import signal
  import subprocess
  import tempfile
  import time
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
  import ray
  from ray.train._internal.storage import StorageContext
  from ray.tune.execution.experiment_state import _find_newest_experiment_checkpoint
  from ray.tune.result import _get_defaults_results_dir
  from ray.tune.utils.serialization import TuneFunctionDecoder
label_desc: Use image node_id 6 for calling a global function with example usage: wait_for_run_or_raise(process, indicator_file, timeout) without return types