def METHOD_NAME() -> None:
    storage_mode = "inmemory"
    def objective(trial: optuna.trial.Trial) -> float:
        callback = PyTorchLightningPruningCallback(trial, monitor="accuracy")
        trainer = pl.Trainer(
            max_epochs=1,
            accelerator="cpu",
            devices=2,
            enable_checkpointing=False,
            callbacks=[callback],
            strategy="ddp_spawn",
        )
        model = ModelDDP()
        trainer.fit(model)
        # Evoke pruning manually.
        callback.check_pruned()
        return 1.0
    with StorageSupplier(storage_mode) as storage:
        study = optuna.create_study(storage=storage, pruner=DeterministicPruner(True))
        with pytest.raises(ProcessRaisedException):
            study.optimize(objective, n_trials=1)