code: def setup(config, cpu, gpu, node, aws, user, overwrite, log):
      """
      Set up .aup environment
  
      :param config: env config
      :param cpu: number of cpu jobs
      :param gpu: gpu configuration file, 'none' if not exist
      :param node: node file, 'none' if not exist
      :param aws: aws file
      :param user: username, user specified > OS USER variable > 'default'
      :param overwrite: overwrite existing .aup environment
      :param log: log level for setupdb
      """
      folder_path = _create_folder(
          config.get("Auptimizer", "Auptimizer_PATH"),
          overwrite=overwrite,
      )
      config.set("Auptimizer", "Auptimizer_PATH", folder_path)
      folder_path = _create_folder(
          config.get("Auptimizer", "TMP_FOLDER"), overwrite=True
      )
      config.set("Auptimizer", "TMP_FOLDER", folder_path)
  
      pending_commands = []
  
      rid = 1
      rid = _set_resource(gpu, config, GPU_RESOURCE_NAME, rid)
      rid = _set_resource(node, config, NODE_RESOURCE_NAME, rid)
      rid = _set_resource(aws, config, AWS_RESOURCE_NAME, rid)
      logger.debug("Create %d resources", rid)
  
      if config.get("Auptimizer", "SQL_ENGINE") == "sqlite":
          tmp_path = os.path.join(
              config.get("Auptimizer", "Auptimizer_PATH"), "sqlite3.db"
          )
          config.set("Auptimizer", "SQLITE_FILE", tmp_path)
          pending_commands.append(
              PYTHON_EXEC
              + " -m aup.setupdb.sqlite %s --user %s --cpu %d --log %s"
              % (
                  os.path.join(
                      config.get("Auptimizer", "Auptimizer_PATH"),
                      "env.ini",
                  ),
                  user,
                  cpu,
                  log,
              )
          )
      else:
          logger.fatal(
              "SQL engine %s is not implemented",
              config.get("Auptimizer", "SQL_ENGINE"),
          )
          exit(1)
  
      env_path = os.path.join(
          config.get("Auptimizer", "Auptimizer_PATH"), "env.ini"
      )
      with open(env_path, "w") as f:
          logger.info("Write env.ini to %s", env_path)
          config.write(f)
      logger.info("Following commands are being executed:")
      for i, command in enumerate(pending_commands):
          logger.info("Executing command: " + command)
          rflag = os.system(command)
          if rflag != 0:
              logger.fatal(
                  "Failed in setup commands\nFollowing commands need finish manually (and debug):\n %s",
                  "\n".join(pending_commands[i:]),
              )
              exit(1)
  
file_path: auptimizer/src/aup/setup.py
imports: import json
  import logging
  import os
  from shutil import rmtree
  import sys
  import click
  import coloredlogs
  from six.moves import input
  from six.moves.configparser import ConfigParser
  from .utils import get_default_username, LOG_LEVEL
label_desc: Use image node_id 5 for calling a global function with example usage: setup(config, cpu, gpu, node, aws, user, overwrite, log) without return types