code: def get_fixed_dirname(worker_id):
      # multi-proc friendly fixed tmp dirname
      path = "/tmp/fixed_tmp_dirname_"
      lrank = (
          int(worker_id.replace("gw", "")) if "gw" in worker_id else 0
      )
  
      def getter(name="test"):
          nonlocal path
          path += name
          time.sleep(0.5 * lrank)
          os.makedirs(path, exist_ok=True)
          return path
  
      yield getter
  
      time.sleep(1.0 * lrank + 1.0)
      if Path(path).exists():
          shutil.rmtree(path)
      # sort of sync
      time.sleep(1.0)
  
imports: import functools
  import os
  import shutil
  import sys
  import tempfile
  import time
  from pathlib import Path
  import pytest
  import torch
  import torch.distributed
  import ignite.distributed
label_desc: Use image node_id 3 for calling a global function with example usage: get_fixed_dirname(worker_id) and returns: path