code: def gather_node_resource(
      band_to_resource: Dict[str, Resource] = None, use_gpu=True
  ):
      # todo numa can be supported by adding more bands
      res = dict()
      mem_info = mars_resource.virtual_memory()
      num_cpu = (
          mars_resource.cpu_count()
          if band_to_resource is None
          else band_to_resource.get("numa-0", ZeroResource).num_cpus
      )
      mem_bytes = (
          mem_info.total
          if band_to_resource is None
          else band_to_resource.get("numa-0", ZeroResource).mem_bytes
      )
      if num_cpu:  # pragma: no branch
          res["numa-0"] = {
              "cpu_avail": mars_resource.cpu_count()
              - mars_resource.cpu_percent() / 100.0,
              "cpu_total": num_cpu,
              "memory_avail": mem_info.available,
              "memory_total": min(mem_info.total, mem_bytes),
          }
  
      if use_gpu:
          for idx, gpu_card_stat in enumerate(
              mars_resource.cuda_card_stats()
          ):  # pragma: no cover
              num_gpu = (
                  1
                  if band_to_resource is None
                  else band_to_resource.get(
                      f"gpu-{idx}", ZeroResource
                  ).num_gpus
              )
              if not num_gpu:
                  continue
              res[f"gpu-{idx}"] = {
                  "gpu_avail": 1 - gpu_card_stat.gpu_usage,
                  "gpu_total": num_gpu,
                  "memory_avail": gpu_card_stat.fb_mem_info.available,
                  "memory_total": gpu_card_stat.fb_mem_info.total,
              }
      return res
  
file_path: mars/mars/services/cluster/gather.py
imports: import logging
  import os
  import platform
  import socket
  import sys
  from typing import Dict, List
  import numpy
  import pandas
  from ...resource import Resource, ZeroResource
  from ...None import resource
  from ...config import options
  from ...utils import git_info, lazy_import
  from ...storage import StorageLevel
  from .core import WorkerSlotInfo, QuotaInfo, DiskInfo, StorageInfo
label_desc: Use image node_id 2 for calling a global function with example usage: gather_node_resource(band_to_resource, use_gpu) and returns: res