code: def monitor_with_mongostat(interval=1, baseline_sleep=5):
      """Compute stats with MongoDB.
  
      This contextmanager is implemented to serve as a reference to validate the proper measure of I/O
      using ptera solely (`monitor_with_ptera`).
      """
      process = MongoStatMonitoring(sleep_time=interval)
      process.start()
      time.sleep(baseline_sleep)
      process.stop.set()
      process.join()
  
      baseline = defaultdict(int)
      while not process.q.empty():
          row = process.q.get(timeout=0.01)
          for i, key in enumerate(keys):
              baseline[key] += row[i]
  
      for key in keys:
          baseline[key] = numpy.array(baseline[key]).mean()
  
      data = ([], [], [])
  
      process = MongoStatMonitoring(sleep_time=interval)
      process.start()
  
      with probing("Runner.gather(trials) > #value") as prb:
          num_completed_trials = (
              prb.buffer_with_time(interval + 1).map(max_trials).accum()
          )
  
          yield data
  
      process.stop.set()
      process.join()
  
      baseline = defaultdict(int)
      while not process.q.empty():
          row = process.q.get(timeout=0.01)
          for i, key in enumerate(keys):
              data[i].append(row[i] - baseline[key])
          data[-1].append(num_completed_trials.pop(0))
  
imports: import argparse
  import contextlib
  import multiprocessing
  import subprocess
  import sys
  import time
  from collections import defaultdict, namedtuple
  import bson
  import numpy
  from ptera import probing
  from orion.client import build_experiment
  from orion.client.runner import Runner
  from orion.core.io.database.pickleddb import PickledDB
  from orion.testing import OrionState
label_desc: Use image node_id 5 for calling a global function with example usage: monitor_with_mongostat(interval, baseline_sleep) without return types