code: def main() -> None:
      info = collect("--detail" in sys.argv)
      if info:
          data = asdict(info, dict_factory=dict_factory)
          data["success"] = True
      else:
          data = {"success": False}
      if errors:
          data["failures"] = sorted(errors)
      print(json.dumps(data), flush=True)
  
file_path: nni/nni/tools/nni_manager_scripts/collect_gpu_info.py
imports: from __future__ import annotations
  from dataclasses import asdict, dataclass
  import json
  import sys
  from typing import Any, Literal
  from pynvml import *
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types