code: def run_and_time_it(f):
      """Runs f in a separate process and times it."""
  
      @wraps(f)
      def wrapper(*args, **kwargs):
          class MyProcess(Process):
              def __init__(self, *args, **kwargs):
                  super(MyProcess, self).__init__(*args, **kwargs)
                  self._pconn, self._cconn = multiprocessing.Pipe()
                  self._exception = None
  
              def run(self):
                  try:
                      super(MyProcess, self).run()
                  except Exception as e:
                      tb = traceback.format_exc()
                      print(tb)
                      self._cconn.send(e)
  
              @property
              def exception(self):
                  if self._pconn.poll():
                      self._exception = self._pconn.recv()
                  return self._exception
  
          p = MyProcess(target=f, args=args, kwargs=kwargs)
          start = time.monotonic()
          p.start()
          p.join()
          if p.exception:
              raise p.exception
          time_taken = time.monotonic() - start
          print(f"{f.__name__} takes {time_taken} seconds.")
          return time_taken
  
      return wrapper
  
file_path: ray/release/air_tests/air_benchmarks/workloads/xgboost_benchmark.py
imports: from functools import wraps
  import json
  import multiprocessing
  from multiprocessing import Process
  import numpy
  import os
  import pandas
  import time
  import traceback
  from typing import Dict
  import xgboost
  import ray
  from ray import data
  from ray.train.xgboost import XGBoostTrainer
  from ray.train import RunConfig, ScalingConfig
label_desc: Use image node_id 1 for calling a global function with example usage: run_and_time_it(f) and returns: wrapper, time_taken, self