code: def _run(
      port_num,
      rank,
      num_parts,
      world_size,
      partitions_dir,
      ntypes,
      id_map,
      test_data,
  ):
      os.environ["MASTER_ADDR"] = "127.0.0.1"
      os.environ["MASTER_PORT"] = str(port_num)
  
      _init_process_group(rank, world_size)
      lookup = _create_lookup_service(
          partitions_dir, ntypes, id_map, rank, world_size, num_parts
      )
  
      tests_exec = 0
      for worker, data in test_data.items():
          if f"rank-{rank}" == worker:
              for item in data:
                  method = item[0]
                  request = item[1]
                  response = item[2]
  
                  if method == "getpartitionids":
                      ret_val = lookup.get_partition_ids(request)
                      tests_exec += 1
                      assert np.all(ret_val == response)
                  else:
                      assert False
  
      # ensure all the tests are executed.
      rank_counts = allgather_sizes(
          [tests_exec], world_size, num_parts, True
      )
      assert np.sum(rank_counts) == len(test_data)
  
imports: import logging
  import os
  import platform
  import tempfile
  from datetime import timedelta
  import dgl
  import numpy
  import pyarrow
  import pytest
  import torch.distributed
  import torch.multiprocessing
  from pytest_utils import create_chunked_dataset
  from tools.distpartitioning import constants, dist_lookup
  from tools.distpartitioning.gloo_wrapper import allgather_sizes
  from tools.distpartitioning.utils import get_idranges, get_ntype_counts_map, read_json
label_desc: Use image node_id 3 for calling a global function with example usage: _run(port_num, rank, num_parts, world_size, partitions_dir, ntypes, id_map, test_data) without return types