code: def test_ddp_with_hydra_runjob(subdir, tmp_path, monkeypatch):
      monkeypatch.chdir(tmp_path)
  
      # Save script locally
      with open("temp.py", "w") as fn:
          fn.write(script)
  
      # Run CLI
      devices = 2
      run_dir = tmp_path / "hydra_output"
      cmd = [
          sys.executable,
          "temp.py",
          f"+devices={devices}",
          '+strategy="ddp"',
          f"hydra.run.dir={run_dir}",
      ]
      if subdir is not None:
          cmd += [f"hydra.output_subdir={subdir}"]
      run_process(cmd)
  
      # Make sure no config.yaml was created for additional processes
      saved_confs = list(run_dir.glob("**/config.yaml"))
      assert len(saved_confs) == (
          0 if subdir == "null" else 1
      )  # Main process has config.yaml iff subdir!="null"
  
      if saved_confs:  # Make sure the parameter was set and used
          cfg = OmegaConf.load(saved_confs[0])
          assert cfg.devices == devices
  
      # Make sure PL spawned jobs that are logged by Hydra
      logs = list(run_dir.glob("**/*.log"))
      assert len(logs) == devices
  
file_path: pytorch-lightning/tests/tests_pytorch/strategies/launchers/test_subprocess_script.py
imports: import subprocess
  import sys
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  from lightning.pytorch.strategies.launchers.subprocess_script import _SubprocessScriptLauncher
  from lightning_utilities.core.imports import RequirementCache
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 1 for calling a global function with example usage: test_ddp_with_hydra_runjob(subdir, tmp_path, monkeypatch) without return types