code: def test_pytorch_parallel(tmp_path: pathlib.Path) -> None:
      launch_config = pytorch_utils.setup_torch_distributed()
  
      root_logfile = tmp_path.joinpath("root_test.log")
  
      outputs = launcher.elastic_launch(launch_config, run_mnist)(
          tmp_path
      )
      launcher.elastic_launch(launch_config, run_mnist)(
          tmp_path, outputs[0]
      )
  
      with open(root_logfile, "r") as f:
          root_log_output = f.readlines()
  
      validation_size = 10000
      num_workers = 2
      global_batch_size = 64
      scheduling_unit = 1
      per_slot_batch_size = global_batch_size // num_workers
      exp_val_batches = (
          validation_size + (per_slot_batch_size - 1)
      ) // per_slot_batch_size
  
      patterns = [
          # Expect two training reports.
          f"report_training_metrics.*steps_completed={1*scheduling_unit}",
          f"report_training_metrics.*steps_completed={2*scheduling_unit}",
          f"validated: {validation_size} records.*in {exp_val_batches} batches",
      ]
  
      utils.assert_patterns_in_logs(root_log_output, patterns)
  
file_path: determined/harness/tests/experiment/pytorch/test_examples.py
imports: import logging
  import os
  import pathlib
  import typing
  import unittest.mock
  import pytest
  import torch
  from torch.distributed import launcher
  from determined import core
  from tests.experiment import pytorch_utils, utils
  from tests.launch import test_util
label_desc: Use image node_id 2 for calling a global function with example usage: test_pytorch_parallel(tmp_path) without return types