code: def test_simple_function_ok_with_right_envvar(nprocs):
      queue = Queue()
  
      def simple_func(queue):
          worldsize = os.environ.get("WORLD_SIZE", None)
          rank = os.environ.get("RANK", None)
          localrank = os.environ.get("LOCAL_RANK", None)
          assert worldsize is not None
          assert rank is not None
          assert localrank is not None
          queue.put(
              {
                  "worldsize": int(worldsize),
                  "rank": int(rank),
                  "localrank": int(localrank),
              }
          )
          return 0
  
      launch(simple_func, queue, nprocs)
  
      results = [queue.get() for _ in range(nprocs)]
      pids = set(range(nprocs))
      for r in results:
          worldsize = r["worldsize"]
          rank = r["rank"]
          localrank = r["localrank"]
          assert worldsize == nprocs
          assert rank in pids
          assert localrank in pids
          pids.remove(rank)
      assert len(pids) == 0
      assert queue.empty()
  
file_path: espnet/test/test_distributed_launch.py
imports: import argparse
  import itertools
  import os
  import sys
  from multiprocessing import Queue
  import pytest
  from espnet.distributed.pytorch_backend.launch import WorkerError, launch
label_desc: Use image node_id 3 for calling a global function with example usage: test_simple_function_ok_with_right_envvar(nprocs) and returns: int