code: def manage_external_experiment(args, mode):
      """view a experiment from external path"""
      # validate arguments
      if not os.path.exists(args.experiment_dir):
          print_error("Folder %s does not exist!" % args.experiment_dir)
          exit(1)
      if not os.path.isdir(args.experiment_dir):
          print_error(
              "Path %s is not folder directory!" % args.experiment_dir
          )
          exit(1)
      if args.id:
          experiment_id = args.id
          log_dir = args.experiment_dir
      else:
          print_normal(
              "NNI can not detect experiment id in argument, will use last folder name as experiment id in experiment_dir argument."
          )
          experiment_id = Path(args.experiment_dir).name
          log_dir = str(Path(args.experiment_dir).parent)
          if not experiment_id:
              print_error(
                  "Please set experiment id argument, or add id as the last folder name in experiment_dir argument."
              )
              exit(1)
      args.url_prefix = None
      experiment_config = Config(experiment_id, log_dir).get_config()
      assert (
          "trainingService" in experiment_config
          or "trainingServicePlatform" in experiment_config
      )
      try:
          if "trainingServicePlatform" in experiment_config:
              experiment_config["logDir"] = log_dir
              launch_experiment(
                  args, experiment_config, mode, experiment_id, 1
              )
          else:
              experiment_config["experimentWorkingDirectory"] = log_dir
              launch_experiment(
                  args, experiment_config, mode, experiment_id, 2
              )
      except Exception as exception:
          print_error(exception)
          exit(1)
  
imports: import json
  import os
  from pathlib import Path
  import sys
  import string
  import random
  import time
  import re
  from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT
  from nni.experiment.config import ExperimentConfig, convert
  from nni.tools.package_utils.tuner_factory import get_builtin_module_class_name
  from .launcher_utils import validate_all_content
  from .rest_utils import rest_put, rest_post, check_rest_server, check_response
  from .url_utils import cluster_metadata_url, experiment_url, get_local_urls, set_prefix_url
  from .config_utils import Config, Experiments
  from .common_utils import get_yml_content, get_json_content, print_error, print_normal, detect_port
  from .constants import NNI_HOME_DIR, ERROR_INFO, REST_TIME_OUT, EXPERIMENT_SUCCESS_INFO, LOG_HEADER
  from .command_utils import check_output_command, kill_command
  from .nnictl_utils import update_experiment
label_desc: Use image node_id 23 for calling a global function with example usage: manage_external_experiment(args, mode) without return types