code: def test_all_rank_logging_ddp_spawn(tmpdir):
      """Check that all ranks can be logged from."""
      model = TestModel()
      all_rank_logger = AllRankLogger()
      trainer = Trainer(
          strategy="ddp_spawn",
          accelerator="gpu",
          devices=2,
          default_root_dir=tmpdir,
          limit_train_batches=1,
          limit_val_batches=1,
          max_epochs=1,
          logger=all_rank_logger,
          enable_model_summary=False,
      )
      trainer.fit(model)
  
imports: import os
  from typing import Any, Dict, Optional, Union
  from unittest.mock import Mock
  import lightning.pytorch
  from lightning.pytorch import Callback, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers.logger import Logger
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: test_all_rank_logging_ddp_spawn(tmpdir) without return types