code: def re_run_current_cmd_for_torch(
      num_procs, output_from_new_proc="ignore"
  ):
      # Script called as `python a/b/c.py`
      if int(os.environ.get("LOCAL_RANK", "0")) == 0:
          if __main__.__spec__ is None:  # pragma: no-cover
              # pull out the commands used to run the script and resolve the abs file path
              command = sys.argv
              command[0] = os.path.abspath(command[0])
              # use the same python interpreter and actually running
              command = [sys.executable] + command
          # Script called as `python -m a.b.c`
          else:
              command = [
                  sys.executable,
                  "-m",
                  __main__.__spec__._name,
              ] + sys.argv[1:]
  
          for rank in range(1, num_procs + 1):
              env_copy = os.environ.copy()
              env_copy["LOCAL_RANK"] = f"{rank}"
              env_copy["WOLRD_SIZE"] = f"{num_procs+1}"
              env_copy["RANK"] = f"{rank}"
  
              # 如果是多机，一定需要用户自己拉起，因此我们自己使用 open_subprocesses 开启的进程的 FASTNLP_GLOBAL_RANK 一定是 LOCAL_RANK；
              env_copy[FASTNLP_GLOBAL_RANK] = str(rank)
  
              proc = distributed_open_proc(
                  output_from_new_proc, command, env_copy, None
              )
  
              delay = np.random.uniform(1, 5, 1)[0]
              time.sleep(delay)
  
imports: import os
  import sys
  import __main__
  from functools import wraps, partial
  from inspect import ismethod
  from copy import deepcopy
  from io import StringIO
  import time
  import signal
  import pytest
  import numpy
  from fastNLP.core.utils.utils import get_class_that_defined_method
  from fastNLP.envs.env import FASTNLP_GLOBAL_RANK
  from fastNLP.core.drivers.utils import distributed_open_proc
  from fastNLP.core.log import logger
label_desc: Use image node_id 3 for calling a global function with example usage: re_run_current_cmd_for_torch(num_procs, output_from_new_proc) without return types