code: def test_rank_zero_call(self):
      os.environ["MASTER_ADDR"] = "127.0.0.1"
      os.environ["MASTER_PORT"] = "29500"
      if (
          "LOCAL_RANK" not in os.environ
          and "RANK" not in os.environ
          and "WORLD_SIZE" not in os.environ
      ):
          os.environ["LOCAL_RANK"] = "0"
          os.environ["RANK"] = "0"
          os.environ["WORLD_SIZE"] = "2"
      re_run_current_cmd_for_torch(1, output_from_new_proc="all")
      with Capturing() as output:
          write_something()
      output = output[0]
  
      if os.environ["LOCAL_RANK"] == "0":
          assert "00000" in output and "11111" not in output
      else:
          assert "00000" not in output and "11111" not in output
  
      with Capturing() as output:
          rank_zero_call(write_other_thing)()
  
      output = output[0]
      if os.environ["LOCAL_RANK"] == "0":
          assert "00000" in output and "11111" not in output
      else:
          assert "00000" not in output and "11111" not in output
  
file_path: fastNLP/tests/core/utils/test_distributed.py
imports: import os
  import pytest
  from fastNLP.envs.distributed import rank_zero_call, all_rank_call_context
  from tests.helpers.utils import re_run_current_cmd_for_torch, Capturing, magic_argv_env_context
label_desc: Use image node_id 1 for calling the TestTorch obj's underlying member method code with example usage: obj.test_rank_zero_call() without return types