code: def register(args):
      if args.package in _builtin_training_services:
          print_error(f"{args.package} is a builtin training service")
          return
  
      try:
          module = importlib.import_module(args.package)
      except Exception:
          print_error(f"Cannot import package {args.package}")
          return
  
      try:
          info = module.nni_training_service_info
      except Exception:
          print_error(
              f"Cannot read nni_training_service_info from {args.package}"
          )
          return
  
      try:
          info.config_class()
      except Exception:
          print_error("Bad experiment config class")
          return
  
      try:
          service_config = {
              "nodeModulePath": str(info.node_module_path),
              "nodeClassName": info.node_class_name,
          }
          json.dumps(service_config)
      except Exception:
          print_error("Bad node_module_path or bad node_class_name")
          return
  
      config = _load()
      update = args.package in config
  
      config[args.package] = service_config
      _save(config)
  
      if update:
          print_green(f"Sucessfully updated {args.package}")
      else:
          print_green(f"Sucessfully registered {args.package}")
  
file_path: nni/nni/tools/nnictl/ts_management.py
imports: import importlib
  import json
  from nni.runtime.config import get_config_file
  from .common_utils import print_error, print_green
label_desc: Use image node_id 1 for calling a global function with example usage: register(args) without return types