code: def fn(fail_rank=None):
      from horovod.runner.common.util.env import get_env_rank_and_size
  
      rank = get_env_rank_and_size()
      if rank and rank[0] == fail_rank:
          raise RuntimeError("failing as expected")
      return rank
  
imports: import contextlib
  import io
  import itertools
  import os
  import sys
  import warnings
  import mock
  from parameterized import parameterized
  import pytest
  import unittest
  from horovod.common.util import gloo_built, mpi_built
  from horovod.runner.common.util import safe_shell_exec
  from horovod.runner import _HorovodArgs
  from horovod.runner.launch import _check_all_hosts_ssh_successful, _run
  from horovod.runner.mpi_run import mpi_available
  from common import capture
label_desc: Use image node_id 2 for calling a global function with example usage: fn(fail_rank) and returns: rank