code: def build_edge_index(
      edge_path, num_nodes, startup_host, startup_port, num_bucket
  ):
      # src, dst = load_data(edge_path)
      rs, nodemanager = get_redis(startup_host, startup_port)
  
      dst_mp, edge_mp = defaultdict(list), defaultdict(list)
      with open(edge_path) as f:
          for l in tqdm.tqdm(f):
              a, b, idx = l.rstrip().split("\t")
              a, b, idx = int(a), int(b), int(idx)
              dst_mp[a].append(b)
              edge_mp[a].append(idx)
      part_dst_dicts = {}
      for i in tqdm.tqdm(range(num_nodes)):
          # if len(edge_index.v[i]) == 0:
          #    continue
          # v = edge_index.v[i].astype("int64").reshape([-1, 1])
          # e = edge_index.eid[i].astype("int64").reshape([-1, 1])
          if i not in dst_mp:
              continue
          v = np.array(dst_mp[i]).astype("int64").reshape([-1, 1])
          e = np.array(edge_mp[i]).astype("int64").reshape([-1, 1])
          o = np.hstack([v, e])
          key = "d:%s" % i
          part = crc16_hash(key) % num_bucket
          if part not in part_dst_dicts:
              part_dst_dicts[part] = {}
          dst_dicts = part_dst_dicts[part]
          dst_dicts["d:%s" % i] = o.tobytes()
          if len(dst_dicts) > 10000:
              slot = nodemanager.keyslot("part-%s" % part)
              node = nodemanager.slots[slot][0]["name"]
              while True:
                  res = rs[node].hmset("part-%s" % part, dst_dicts)
                  if res:
                      break
                  log.info("HMSET FAILED RETRY connected %s" % node)
                  time.sleep(1)
              part_dst_dicts[part] = {}
  
      for part, dst_dicts in part_dst_dicts.items():
          if len(dst_dicts) > 0:
              slot = nodemanager.keyslot("part-%s" % part)
              node = nodemanager.slots[slot][0]["name"]
              while True:
                  res = rs[node].hmset("part-%s" % part, dst_dicts)
                  if res:
                      break
                  log.info("HMSET FAILED RETRY connected %s" % node)
                  time.sleep(1)
              part_dst_dicts[part] = {}
      log.info("dst_dict Done")
  
imports: import sys
  import json
  import logging
  from collections import defaultdict
  import tqdm
  import redis
  from redis._compat import b, unicode, bytes, long, basestring
  from rediscluster.nodemanager import NodeManager
  from rediscluster.crc import crc16
  import argparse
  import time
  import pickle
  import numpy
  import scipy.sparse
label_desc: Use image node_id 5 for calling a global function with example usage: build_edge_index(edge_path, num_nodes, startup_host, startup_port, num_bucket) without return types