class_docstr: Launches processes that run a given function in parallel, and joins them all at the end.
  
  The main process in which this launcher is invoked creates N so-called worker processes (using
  :func:`torch.multiprocessing.start_processes`) that run the given function.
  Worker processes have a rank that ranges from 0 to N - 1.
  
  Note:
      - This launcher requires all objects to be pickleable.
      - It is important that the entry point to the program/script is guarded by ``if __name__ == "__main__"``.
      - With start method 'fork' the user must ensure that no CUDA context gets created in the main process before
        the launcher is invoked. E.g., one should avoid creating cuda tensors or calling ``torch.cuda.*`` functions
        before calling ``Trainer.fit``.
  
  Args:
      strategy: A reference to the strategy that is used together with this launcher.
      start_method: The method how to start the processes.
          - 'spawn': The default start method. Requires all objects to be pickleable.
          - 'fork': Preferable for IPython/Jupyter environments where 'spawn' is not available. Not available on
            the Windows platform for example.
          - 'forkserver': Alternative implementation to 'fork'.
code: def _recover_results_in_main_process(
      self, worker_output: "_WorkerOutput", trainer: "pl.Trainer"
  ) -> None:
      # transfer back the best path to the trainer
      if trainer.checkpoint_callback and hasattr(
          trainer.checkpoint_callback, "best_model_path"
      ):
          trainer.checkpoint_callback.best_model_path = str(
              worker_output.best_model_path
          )
  
      # TODO: pass also best score
      # load last weights
      if worker_output.weights_path is not None:
          ckpt = self._strategy.checkpoint_io.load_checkpoint(
              worker_output.weights_path
          )
          # choose non-strict loading of parameters on the main process, because the model's composition
          # could have changed in the worker process (layers added or removed)
          trainer.lightning_module.load_state_dict(ckpt, strict=False)
          self._strategy.checkpoint_io.remove_checkpoint(
              worker_output.weights_path
          )
  
      trainer.state = worker_output.trainer_state
  
      # get the `callback_metrics` and set it to the trainer
      self.update_main_process_results(trainer, worker_output.extra)
  
imports: import logging
  import os
  import queue
  import tempfile
  from contextlib import suppress
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Literal, NamedTuple, Optional, Union
  import numpy
  import torch
  import torch.backends.cudnn
  import torch.multiprocessing
  from lightning_utilities.core.apply_func import apply_to_collection
  from torch import Tensor
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.strategies.launchers.multiprocessing import _check_bad_cuda_fork, _check_missing_main_guard, _disable_module_memory_sharing
  from lightning.fabric.utilities import move_data_to_device
  from lightning.fabric.utilities.distributed import _set_num_threads_if_needed
  from lightning.fabric.utilities.seed import _collect_rng_states, _set_rng_states
  from lightning.fabric.utilities.types import _PATH
  from lightning.pytorch.accelerators import CPUAccelerator
  from lightning.pytorch.strategies.launchers.launcher import _Launcher
  from lightning.pytorch.trainer.connectors.signal_connector import _SIGNUM
  from lightning.pytorch.trainer.states import TrainerFn, TrainerState
  from lightning.pytorch.utilities.rank_zero import rank_zero_debug
label_desc: Use image node_id 5 for calling the _MultiProcessingLauncher obj's underlying member method code with example usage: obj._recover_results_in_main_process(worker_output, trainer) without return types