code: def get_worker_affinity(num_workers, worker_idx):
      from torch.backends.xeon.run_cpu import _CPUinfo
  
      cpuinfo = _CPUinfo()
      num_cores = cpuinfo._physical_core_nums()
  
      num_cores_per_worker = num_cores // num_workers
      start = worker_idx * num_cores_per_worker
      end = (worker_idx + 1) * num_cores_per_worker - 1
      curr_worker_cores = [i for i in range(start, end + 1)]
      affinity = "numactl -C {}-{}".format(str(start), str(end))
      affinity += " -m {}".format(
          ",".join(
              [
                  str(numa_id)
                  for numa_id in cpuinfo.numa_aware_check(
                      curr_worker_cores
                  )
              ]
          )
      )
      return affinity
  
file_path: serve/test/pytest/test_example_intel_extension_for_pytorch.py
imports: import json
  import os
  import subprocess
  import pytest
  import requests
  import test_utils
  import torch
  from test_handler import run_inference_using_url_with_data
label_desc: Use image node_id 3 for calling a global function with example usage: get_worker_affinity(num_workers, worker_idx) and returns: affinity