code: def schedule_processors(
      num_workers: int, cores_per_worker: Optional[int] = None
  ):
      import os
  
      cpu_procs = schedule_workers(num_workers, cores_per_worker)
  
      envs = []
      if cpu_procs[0]:
          for i in range(num_workers):
              env = os.environ.copy()
  
              env.update(
                  {
                      "KMP_AFFINITY": f"granularity=fine,proclist"
                      f"=[{','.join([str(i) for i in cpu_procs[i]])}],explicit",
                      "OMP_NUM_THREADS": str(len(cpu_procs[i])),
                      "PROCESS_IDX": str(i),
                  }
              )
              envs.append(env)
      else:
          for i in range(num_workers):
              env = os.environ.copy()
  
              env.update(
                  {
                      "KMP_AFFINITY": "disabled",
                      "OMP_NUM_THREADS": "1",
                      "PROCESS_IDX": str(i),
                  }
              )
              envs.append(env)
      return envs
  
file_path: BigDL/python/nano/src/bigdl/nano/utils/common/schedule.py
imports: import subprocess
  import re
  import os
  from typing import Optional
  import platform
  import cpuinfo
  from bigdl.nano.utils.common import invalidInputError
label_desc: Use image node_id 4 for calling a global function with example usage: schedule_processors(num_workers, cores_per_worker) and returns: envs