Skip to content

Commit 772d121

Browse files
authored
[App] Improve debug triggering (#15951)
1 parent 482b279 commit 772d121

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/lightning_app/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6060

6161
- Fixed the `enable_spawn` method of the `WorkRunExecutor` ([#15812](https://github.com/Lightning-AI/lightning/pull/15812)
6262

63+
6364
- Fixed Sigterm Handler causing thread lock which caused KeyboardInterrupt to hang ([#15881](https://github.com/Lightning-AI/lightning/pull/15881))
6465

6566
- Fixed a bug where using `L.app.structures` would cause multiple apps to be opened and fail with an error in the cloud ([#15911](https://github.com/Lightning-AI/lightning/pull/15911))
@@ -68,6 +69,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6869

6970
- Fixed multiprocessing breakpoint ([#15950](https://github.com/Lightning-AI/lightning/pull/15950))
7071

72+
- Fixed detection of a Lightning App running in debug mode ([#15951](https://github.com/Lightning-AI/lightning/pull/15951))
73+
74+
7175
## [1.8.3] - 2022-11-22
7276

7377
### Changed

src/lightning_app/core/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,10 @@ def __init__(
9393
>>> from lightning_app.runners import MultiProcessRuntime
9494
>>> class RootFlow(LightningFlow):
9595
... def run(self):
96-
... print("Hello World!")
9796
... self._exit()
9897
...
9998
>>> app = LightningApp(RootFlow()) # application can be dispatched using the `runners`.
10099
>>> MultiProcessRuntime(app).dispatch()
101-
Hello World!
102100
"""
103101

104102
self.root_path = root_path # when running behind a proxy

src/lightning_app/utilities/app_helpers.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,10 @@ def is_static_method(klass_or_instance, attr) -> bool:
511511
return isinstance(inspect.getattr_static(klass_or_instance, attr), staticmethod)
512512

513513

514-
def _debugger_is_active() -> bool:
515-
"""Return if the debugger is currently active."""
516-
return hasattr(sys, "gettrace") and sys.gettrace() is not None
517-
518-
519514
def _should_dispatch_app() -> bool:
520515
return (
521-
_debugger_is_active()
516+
__debug__
517+
and "_pytest.doctest" not in sys.modules
522518
and not bool(int(os.getenv("LIGHTNING_DISPATCHED", "0")))
523519
and "LIGHTNING_APP_STATE_URL" not in os.environ
524520
)

0 commit comments

Comments
 (0)