code: def resume_experiment(args):
      exp_id = args.id
      port = args.port
      debug = args.debug
      foreground = args.foreground
      exp_dir = args.experiment_dir
  
      # NOTE: Backward compatibility
      config_json = get_stopped_experiment_config_json(exp_id, exp_dir)
      if config_json.get("trainingServicePlatform"):
          legacy_launcher.resume_experiment(args)
          exit()
  
      config = ExperimentConfig(**config_json)
      if type(config) != ExperimentConfig:
          _logger.error(
              "Non-HPO experiment cannot be resumed with nnictl. Please use experiment.resume() in Python API."
          )
          exit(1)
  
      experiment = Experiment(config, id=exp_id)
      # Do not need to call `load_checkpoint()` here as there is nothing to load.
      experiment._action = "resume"
      # Can't use experiment.resume() here because resume() will automatically run in RunMode.Background,
      # and thus the NNI manager process will be killed once the main process exits.
      experiment.start(
          port,
          debug,
          RunMode.Foreground if foreground else RunMode.Detach,
      )
  
file_path: nni/nni/tools/nnictl/launcher.py
imports: import logging
  from pathlib import Path
  from colorama import Fore
  import yaml
  from nni.experiment import Experiment, RunMode
  from nni.experiment.config import ExperimentConfig, convert, utils
  from nni.experiment.launcher import get_stopped_experiment_config_json
  from .None import legacy_launcher
label_desc: Use image node_id 2 for calling a global function with example usage: resume_experiment(args) without return types