From 6a2a83a21e021da1aa9282456f001f680fdf3610 Mon Sep 17 00:00:00 2001 From: thomas chaton Date: Sat, 26 Nov 2022 02:18:13 +0000 Subject: [PATCH] [App] Resolve a condition bug with spawning (#15812) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos MocholĂ­ --- src/lightning_app/CHANGELOG.md | 3 +++ src/lightning_app/utilities/proxies.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lightning_app/CHANGELOG.md b/src/lightning_app/CHANGELOG.md index 4c5da2c96e2e4..54219e0f31eed 100644 --- a/src/lightning_app/CHANGELOG.md +++ b/src/lightning_app/CHANGELOG.md @@ -43,6 +43,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed the PyTorch Inference locally on GPU ([#15813](https://github.com/Lightning-AI/lightning/pull/15813)) +- Fixed the `enable_spawn` method of the `WorkRunExecutor` ([#15812](https://github.com/Lightning-AI/lightning/pull/15812)) + + ## [1.8.2] - 2022-11-17 ### Added diff --git a/src/lightning_app/utilities/proxies.py b/src/lightning_app/utilities/proxies.py index 07b03da7d9201..2e7dc6ce7efec 100644 --- a/src/lightning_app/utilities/proxies.py +++ b/src/lightning_app/utilities/proxies.py @@ -17,6 +17,7 @@ from deepdiff import DeepDiff, Delta from lightning_utilities.core.apply_func import apply_to_collection +from lightning_app.core.queues import MultiProcessQueue from lightning_app.storage import Path from lightning_app.storage.copier import _Copier, _copy_files from lightning_app.storage.drive import _maybe_create_drive, Drive @@ -357,7 +358,7 @@ def enable_spawn(self) -> Generator: yield def _clean_queues(self): - if "LIGHTNING_APP_STATE_URL" in os.environ: + if not isinstance(self.work._request_queue, MultiProcessQueue): self.work._request_queue = self.work._request_queue.to_dict() self.work._response_queue = self.work._response_queue.to_dict()