code: def _set_adaptdl_signal_handler():
      import signal
  
      global _trial_process
  
      def _handler(signum, frame):
          nni_log(LogType.Info, "RECEIVED SIGNAL {}".format(signum))
          nni_log(
              LogType.Debug,
              "TRIAL PROCESS ID {}".format(_trial_process.pid),
          )
          if _trial_process and (
              signum == signal.SIGTERM or signum == signal.SIGINT
          ):
              os.killpg(os.getpgid(_trial_process.pid), signal.SIGINT)
              os.waitpid(_trial_process.pid, 0)
          exit(1)
  
      signal.signal(signal.SIGTERM, _handler)
      signal.signal(signal.SIGINT, _handler)
  
imports: import argparse
  import ctypes
  import json
  import logging
  import os
  import re
  import shlex
  import sys
  import threading
  import time
  from subprocess import Popen
  import pkg_resources
  from pyhdfs import HdfsClient
  from .constants import LOG_DIR, MULTI_PHASE, NNI_EXP_ID, NNI_PLATFORM, NNI_SYS_DIR, NNI_TRIAL_JOB_ID
  from .hdfsClientUtility import copyDirectoryToHdfs, copyHdfsDirectoryToLocal, copyHdfsFileToLocal
  from .log_utils import LogType, RemoteLogger, StdOutputType, nni_log
  from .rest_utils import rest_get, rest_post
  from .url_utils import gen_parameter_meta_url, gen_send_version_url
label_desc: Use image node_id 8 for calling a global function with example usage: _set_adaptdl_signal_handler() without return types