code: def install_and_restart(code_channel: Optional[Path], packages: Path):
      # skip if there is no code, and if we already done our work
      if code_channel is None or "__SHELL_RELOADED__" in os.environ:
          return
  
      packages.mkdir(exist_ok=True)
  
      inst = Installer(packages)
      inst.install(code_channel)
      inst.cleanup()
  
      python_path = os.environ.get("PYTHONPATH", "")
      python_path = f"{packages}:{python_path}"
  
      os.environ.update(__SHELL_RELOADED__="1", PYTHONPATH=python_path)
  
      # restart
      os.execve(
          sys.executable,
          [sys.executable, "-m", "gluonts.shell"] + sys.argv[1:],
          os.environ,
      )
  
file_path: gluonts/src/gluonts/shell/sagemaker/dyn.py
imports: import os
  import shutil
  import subprocess
  import sys
  import tarfile
  import tempfile
  import zipfile
  from functools import partial
  from pathlib import Path
  from typing import Optional
  from gluonts.util import safe_extractall
label_desc: Use image node_id 1 for calling a global function with example usage: install_and_restart(code_channel, packages) without return types