Skip to content

Commit 42494b6

Browse files
ethanwharrisBorda
authored andcommitted
[App] Remove SingleProcessRuntime (#15933)
* Remove SingleProcessRuntime * Remove unused queues * Docs (cherry picked from commit e250dfe)
1 parent a0d3475 commit 42494b6

File tree

21 files changed

+96
-209
lines changed

21 files changed

+96
-209
lines changed

docs/source-app/api_reference/runners.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ ______________
1818
:template: classtemplate.rst
1919

2020
~cloud.CloudRuntime
21-
~singleprocess.SingleProcessRuntime
2221
~multiprocess.MultiProcessRuntime

docs/source-app/api_references.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ _______
8989
:template: classtemplate_no_index.rst
9090

9191
~cloud.CloudRuntime
92-
~singleprocess.SingleProcessRuntime
9392
~multiprocess.MultiProcessRuntime
9493

9594
----

docs/source-app/testing.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ We provide ``application_testing`` as a helper funtion to get your application u
120120
os.path.join(_PROJECT_ROOT, "examples/app_v0/app.py"),
121121
"--blocking",
122122
"False",
123-
"--multiprocess",
124123
"--open-ui",
125124
"False",
126125
]
@@ -129,9 +128,7 @@ First in the list for ``command_line`` is the location of your script. It is an
129128

130129
Next there are a couple of options you can leverage:
131130

132-
133131
* ``blocking`` - Blocking is an app status that says "Do not run until I click run in the UI". For our integration test, since we are not using the UI, we are setting this to "False".
134-
* ``multiprocess/singleprocess`` - This is the runtime your app is expected to run under.
135132
* ``open-ui`` - We set this to false since this is the routine that opens a browser for your local execution.
136133

137134
Once you have your commandline ready, you will then be able to kick off the test and gather results:

examples/app_template_streamlit_ui/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import logging
22

3-
from lightning_app import LightningApp, LightningFlow
4-
from lightning_app.frontend import StreamlitFrontend
5-
from lightning_app.utilities.state import AppState
3+
from lightning.app import LightningApp, LightningFlow
4+
from lightning.app.frontend import StreamlitFrontend
5+
from lightning.app.utilities.state import AppState
66

77
logger = logging.getLogger(__name__)
88

@@ -45,4 +45,4 @@ def configure_layout(self):
4545
return [{"name": "StreamLitUI", "content": self.streamlit_ui}]
4646

4747

48-
app = LightningApp(HelloWorld(), log_level="debug")
48+
app = LightningApp(HelloWorld())

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ module = [
102102
"lightning_app.runners.cloud",
103103
"lightning_app.runners.multiprocess",
104104
"lightning_app.runners.runtime",
105-
"lightning_app.runners.singleprocess",
106105
"lightning_app.source_code.copytree",
107106
"lightning_app.source_code.hashing",
108107
"lightning_app.source_code.local",

src/lightning_app/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1212
- Added the CLI command `lightning run model` to launch a `LightningLite` accelerated script ([#15506](https://github.com/Lightning-AI/lightning/pull/15506))
1313
- Added the CLI command `lightning delete app` to delete a lightning app on the cloud ([#15783](https://github.com/Lightning-AI/lightning/pull/15783))
1414
- Added a CloudMultiProcessBackend which enables running a child App from within the Flow in the cloud ([#15800](https://github.com/Lightning-AI/lightning/pull/15800))
15-
- Apps without UIs no longer activate the "Open App" button when running in the cloud ([#15875](https://github.com/Lightning-AI/lightning/pull/15875))
1615
- Added `AutoScaler` component ([#15769](https://github.com/Lightning-AI/lightning/pull/15769))
1716
- Added the property `ready` of the LightningFlow to inform when the `Open App` should be visible ([#15921](https://github.com/Lightning-AI/lightning/pull/15921))
1817
- Added private work attributed `_start_method` to customize how to start the works ([#15923](https://github.com/Lightning-AI/lightning/pull/15923))
@@ -26,6 +25,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2625
- Show a message when `BuildConfig(requirements=[...])` is passed but a `requirements.txt` file is already present in the Work ([#15799](https://github.com/Lightning-AI/lightning/pull/15799))
2726
- Show a message when `BuildConfig(dockerfile="...")` is passed but a `Dockerfile` file is already present in the Work ([#15799](https://github.com/Lightning-AI/lightning/pull/15799))
2827
- Dropped name column from cluster list ([#15721](https://github.com/Lightning-AI/lightning/pull/15721))
28+
- Apps without UIs no longer activate the "Open App" button when running in the cloud ([#15875](https://github.com/Lightning-AI/lightning/pull/15875))
29+
30+
### Removed
31+
32+
- Removed the `SingleProcessRuntime` ([#15933](https://github.com/Lightning-AI/lightning/pull/15933))
2933

3034
### Fixed
3135

src/lightning_app/components/auto_scaler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from lightning_app.utilities.packaging.cloud_compute import CloudCompute
2626

2727
logger = Logger(__name__)
28-
lock = asyncio.Lock()
2928

3029

3130
def _raise_granular_exception(exception: Exception) -> None:
@@ -209,6 +208,7 @@ async def process_request(self, data: BaseModel):
209208
def run(self):
210209

211210
logger.info(f"servers: {self.servers}")
211+
lock = asyncio.Lock()
212212

213213
self._iter = cycle(self.servers)
214214
self._last_batch_sent = time.time()

src/lightning_app/core/app.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
FRONTEND_DIR,
2222
STATE_ACCUMULATE_WAIT,
2323
)
24-
from lightning_app.core.queues import BaseQueue, SingleProcessQueue
24+
from lightning_app.core.queues import BaseQueue
2525
from lightning_app.core.work import LightningWork
2626
from lightning_app.frontend import Frontend
2727
from lightning_app.storage import Drive, Path, Payload
@@ -549,8 +549,6 @@ def _collect_work_finish_status(self) -> dict:
549549
def _should_snapshot(self) -> bool:
550550
if len(self.works) == 0:
551551
return True
552-
elif isinstance(self.delta_queue, SingleProcessQueue):
553-
return True
554552
elif self._has_updated:
555553
work_finished_status = self._collect_work_finish_status()
556554
if work_finished_status:

src/lightning_app/core/queues.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050

5151
class QueuingSystem(Enum):
52-
SINGLEPROCESS = "singleprocess"
5352
MULTIPROCESS = "multiprocess"
5453
REDIS = "redis"
5554
HTTP = "http"
@@ -59,10 +58,8 @@ def get_queue(self, queue_name: str) -> "BaseQueue":
5958
return MultiProcessQueue(queue_name, default_timeout=STATE_UPDATE_TIMEOUT)
6059
elif self == QueuingSystem.REDIS:
6160
return RedisQueue(queue_name, default_timeout=REDIS_QUEUES_READ_DEFAULT_TIMEOUT)
62-
elif self == QueuingSystem.HTTP:
63-
return HTTPQueue(queue_name, default_timeout=STATE_UPDATE_TIMEOUT)
6461
else:
65-
return SingleProcessQueue(queue_name, default_timeout=STATE_UPDATE_TIMEOUT)
62+
return HTTPQueue(queue_name, default_timeout=STATE_UPDATE_TIMEOUT)
6663

6764
def get_api_response_queue(self, queue_id: Optional[str] = None) -> "BaseQueue":
6865
queue_name = f"{queue_id}_{API_RESPONSE_QUEUE_CONSTANT}" if queue_id else API_RESPONSE_QUEUE_CONSTANT
@@ -179,21 +176,6 @@ def is_running(self) -> bool:
179176
return True
180177

181178

182-
class SingleProcessQueue(BaseQueue):
183-
def __init__(self, name: str, default_timeout: float):
184-
self.name = name
185-
self.default_timeout = default_timeout
186-
self.queue = queue.Queue()
187-
188-
def put(self, item):
189-
self.queue.put(item)
190-
191-
def get(self, timeout: int = None):
192-
if timeout == 0:
193-
timeout = self.default_timeout
194-
return self.queue.get(timeout=timeout, block=(timeout is None))
195-
196-
197179
class MultiProcessQueue(BaseQueue):
198180
def __init__(self, name: str, default_timeout: float):
199181
self.name = name
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from lightning_app.runners.cloud import CloudRuntime
22
from lightning_app.runners.multiprocess import MultiProcessRuntime
33
from lightning_app.runners.runtime import dispatch, Runtime
4-
from lightning_app.runners.singleprocess import SingleProcessRuntime
54
from lightning_app.utilities.app_commands import run_app_commands
65
from lightning_app.utilities.load_app import load_app_from_file
76

@@ -11,6 +10,5 @@
1110
"run_app_commands",
1211
"Runtime",
1312
"MultiProcessRuntime",
14-
"SingleProcessRuntime",
1513
"CloudRuntime",
1614
]

0 commit comments

Comments
 (0)