Skip to content

Commit

Permalink
[App] Improve debug triggering (#15951)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaton authored Dec 8, 2022
1 parent 482b279 commit 772d121
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/lightning_app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

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


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

- 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))
Expand All @@ -68,6 +69,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

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

- Fixed detection of a Lightning App running in debug mode ([#15951](https://github.com/Lightning-AI/lightning/pull/15951))


## [1.8.3] - 2022-11-22

### Changed
Expand Down
2 changes: 0 additions & 2 deletions src/lightning_app/core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ def __init__(
>>> from lightning_app.runners import MultiProcessRuntime
>>> class RootFlow(LightningFlow):
... def run(self):
... print("Hello World!")
... self._exit()
...
>>> app = LightningApp(RootFlow()) # application can be dispatched using the `runners`.
>>> MultiProcessRuntime(app).dispatch()
Hello World!
"""

self.root_path = root_path # when running behind a proxy
Expand Down
8 changes: 2 additions & 6 deletions src/lightning_app/utilities/app_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,10 @@ def is_static_method(klass_or_instance, attr) -> bool:
return isinstance(inspect.getattr_static(klass_or_instance, attr), staticmethod)


def _debugger_is_active() -> bool:
"""Return if the debugger is currently active."""
return hasattr(sys, "gettrace") and sys.gettrace() is not None


def _should_dispatch_app() -> bool:
return (
_debugger_is_active()
__debug__
and "_pytest.doctest" not in sys.modules
and not bool(int(os.getenv("LIGHTNING_DISPATCHED", "0")))
and "LIGHTNING_APP_STATE_URL" not in os.environ
)
Expand Down

0 comments on commit 772d121

Please sign in to comment.