code: def run_safely(runargs):
      id = get_arg_hash(runargs)
      if os.path.exists("testfeatures/%s.done" % id):
          print("not rerunning %s" % id)
          return
  
      print("Running %s with options:" % id, runargs)
  
      def timeout_handler(signum, frame):
          raise Exception("Timeout")
  
      signal.signal(signal.SIGALRM, timeout_handler)
  
      signal.alarm(60 * (1 + runargs["x_dim"]))  # give a few minutes
      try:
          main(AttrDict(runargs))
      except Exception:
          traceback.print_exc()
          filename = "testfeatures/runsettings-%s-error.json" % id
          print(
              "Storing configuration as '%s'. Options were:" % filename,
              runargs,
          )
          with open(filename, "w") as f:
              json.dump(runargs, f, indent=2)
          sys.exit(1)
      signal.alarm(0)
      with open("testfeatures/%s.done" % id, "w"):
          pass
  
file_path: ultranest/examples/testfeatures.py
imports: import numpy
  import shutil
  import scipy.stats
  import traceback
  import json
  import random
  import sys
  import os
  import signal
  import string
  import hashlib
label_desc: Use image node_id 3 for calling a global function with example usage: run_safely(runargs) without return types