code: def test_one_rank_first(
      distributed, get_rank_zero_dirname, rank, local
  ):
      def get_ds(file_path):
          rank = idist.get_local_rank() if local else idist.get_rank()
          if not file_path.exists():
              with open(file_path, "w") as f:
                  f.write("readed")
              return f"{rank} not readed"
          else:
              return f"{rank} readed"
  
      folder = get_rank_zero_dirname()
      file_path = folder / "res.txt"
  
      with idist.one_rank_first(rank, local=local):
          x = get_ds(file_path)
  
      output = idist.all_gather(x)
  
      if local:
          expected = [
              f"{x} not readed" if x == rank else f"{x} readed"
              for x in range(idist.get_nproc_per_node())
          ] * idist.get_nnodes()
      else:
          expected = [
              f"{x} not readed" if x == rank else f"{x} readed"
              for x in range(idist.get_world_size())
          ]
  
      print("expected:", expected, idist.get_nnodes())
      assert set(expected) == set(output)
  
imports: import os
  import pytest
  import torch
  import torch.distributed
  from packaging.version import Version
  import ignite.distributed
  from ignite.distributed.utils import has_native_dist_support
  from tests.ignite.distributed.utils import _test_distrib__get_max_length, _test_distrib_all_gather, _test_distrib_all_gather_group, _test_distrib_all_reduce, _test_distrib_all_reduce_group, _test_distrib_barrier, _test_distrib_broadcast, _test_distrib_config, _test_distrib_new_group, _test_distrib_one_rank_only, _test_distrib_one_rank_only_with_engine, _test_sync
label_desc: Use image node_id 32 for calling a global function with example usage: test_one_rank_first(distributed, get_rank_zero_dirname, rank, local) and returns: rank, str, rank, str