code: def run_environment(apis, override_config={}):
      api_str = ",".join(apis)
  
      override_recursive(config_json, override_config)
  
      with open(CONFIG_PATH, "wt") as f:
          f.write(json.dumps(config_json))
  
      os.environ["CHECK_FOR_UPDATES"] = "0"
      print("Starting mindsdb process!")
      subprocess.Popen(
          [
              "python3",
              "-m",
              "mindsdb",
              f"--api={api_str}",
              f"--config={CONFIG_PATH}",
              "--verbose",
          ],
          close_fds=True,
          stdout=OUTPUT,
          stderr=OUTPUT,
      )
      atexit.register(close_ssh_tunnel, port=mindsdb_port)
      atexit.register(stop_mindsdb, ports=[mindsdb_port])
  
      print("Waiting on ports!")
  
      async def wait_port_async(port, timeout):
          start_time = time.time()
          started = is_port_in_use(port)
          while (
              time.time() - start_time
          ) < timeout and started is False:
              await asyncio.sleep(1)
              started = is_port_in_use(port)
          return started
  
      async def wait_apis_start(ports):
          futures = [wait_port_async(port, 200) for port in ports]
          success = True
          for i, future in enumerate(asyncio.as_completed(futures)):
              success = success and await future
          return success
  
      ports_to_wait = [config_json["api"][api]["port"] for api in apis]
  
      ioloop = asyncio.get_event_loop()
      if ioloop.is_closed():
          ioloop = asyncio.new_event_loop()
      success = ioloop.run_until_complete(
          wait_apis_start(ports_to_wait)
      )
      ioloop.close()
      if not success:
          raise Exception("Cant start mindsdb apis")
      print("Done waiting, mindsdb has started!")
  
imports: import time
  import os
  import json
  import subprocess
  import atexit
  import asyncio
  import re
  import sys
  from pathlib import Path
  import signal
  import psutil
  import requests
  from pandas import DataFrame
  from ps import wait_port, is_port_in_use, net_connections
label_desc: Use image node_id 8 for calling a global function with example usage: run_environment(apis, override_config) and returns: started, success