code: def mindsdb_app(request, config):
      """Start mindsdb app before tests and stop it after ones.
      Takes 'OVERRIDE_CONFIG' and 'API_LIST' from test module (file)
      """
      if os.environ.get("MICROSERVICE_MODE", False):
          cmd = [
              "docker-compose",
              "-f",
              "./docker/docker-compose-ci.yml",
              "up",
          ]
          timeout = 1800
      else:
          apis = getattr(request.module, "API_LIST", [])
          if not apis:
              api_str = "http,mysql"
          else:
              api_str = ",".join(apis)
          to_override_conf = getattr(
              request.module, "OVERRIDE_CONFIG", {}
          )
          if to_override_conf:
              override_recursive(config, to_override_conf)
          config_path = TEMP_DIR.joinpath("config.json")
          with open(config_path, "wt") as f:
              f.write(json.dumps(config))
  
          os.environ["CHECK_FOR_UPDATES"] = "0"
          cmd = [
              "python3",
              "-m",
              "mindsdb",
              f"--api={api_str}",
              f"--config={config_path}",
              "--verbose",
          ]
          if getattr(request.module, "USE_GUI", False) is False:
              cmd.append("--no_studio")
          if (
              getattr(request.module, "ML_TASK_QUEUE_CONSUMER", False)
              is True
          ):
              cmd.append("--ml_task_queue_consumer")
          timeout = 90
  
      print("Starting mindsdb process!")
      app = subprocess.Popen(
          cmd,
          close_fds=True,
          stdout=sys.stdout,
          stderr=sys.stderr,
          shell=False,
      )
      threshold = time.time() + timeout
  
      while True:
          try:
              host = config["api"]["http"]["host"]
              port = config["api"]["http"]["port"]
              r = requests.get(f"http://{host}:{port}/api/util/ping")
              r.raise_for_status()
              break
          except Exception:
              time.sleep(1)
              if time.time() > threshold:
                  raise Exception(
                      f"unable to launch mindsdb app in {timeout} seconds"
                  )
  
      def cleanup():
          print("Stopping Application")
          if os.environ.get("MICROSERVICE_MODE", False):
              cmd = "docker-compose -f ./docker/docker-compose-ci.yml down"
              subprocess.run(cmd, shell=True)
              # shutil.rmtree("./var")
          else:
              for ch in get_child_pids(app.pid):
                  try:
                      ch.kill()
                  except psutil.NoSuchProcess:
                      pass
              app.kill()
  
      request.addfinalizer(cleanup)
      return
  
imports: import os
  import sys
  import time
  import json
  import subprocess
  from pathlib import Path
  import docker
  import pytest
  import psutil
  import requests
  import netifaces
  import pandas
  from walrus import Database
  from mindsdb.utilities.ps import get_child_pids
label_desc: Use image node_id 7 for calling a global function with example usage: mindsdb_app(request, config) without return types