code: def get_nr_procs(df=None):
      if "LIGHTWOOD_N_WORKERS" in os.environ:
          try:
              n = int(os.environ["LIGHTWOOD_N_WORKERS"])
          except ValueError:
              n = 1
          return n
      elif os.name == "nt":
          return 1
      else:
          available_mem = psutil.virtual_memory().available
          max_per_proc_usage = 2 * pow(10, 8)
  
          if df is not None:
              max_per_proc_usage += df.memory_usage(
                  index=True, deep=True
              ).sum()
          proc_count = (
              min(mp.cpu_count(), available_mem // max_per_proc_usage)
              - 1
          )
  
          return max(proc_count, 1)
  
file_path: lightwood/lightwood/helpers/parallelism.py
imports: import os
  from typing import Dict
  import psutil
  import multiprocessing
  from lightwood.helpers.log import log
label_desc: Use image node_id 1 for calling a global function with example usage: get_nr_procs(df) and returns: n, int, max