code: def test_worker_raises_exception_ng(nprocs):
      for combination in itertools.product(range(2), repeat=nprocs):
          n_activated = sum(combination)
          if n_activated != 1 and n_activated != nprocs:
              # skip.
              continue
          if n_activated == 1:
              exit_idx = combination.index(1)
          else:
              exit_idx = None
          args = None
  
          def simple_func(args):
              # NOP
              rank = os.environ.get("RANK", None)
              assert rank is not None
              rank = int(rank)
              if n_activated == 1 and rank != exit_idx:
                  return
              raise RuntimeError("error")
  
          with pytest.raises(WorkerError) as excinfo:
              launch(simple_func, args, nprocs)
          assert excinfo.value.exitcode == 1
          if n_activated == 1:
              assert excinfo.value.worker_id == exit_idx
  
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 5 for calling a global function with example usage: test_worker_raises_exception_ng(nprocs) without return types