Skip to content

Commit 173e29e

Browse files
tchatonlexierule
authored andcommitted
[App] Hot Fix: Missing root flow in app.flows (#15531)
(cherry picked from commit 1824ad0)
1 parent f4925fd commit 173e29e

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

src/lightning_app/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
4949

5050
- Fixed writing app name and id in connect.txt file for the command CLI ([#15443](https://github.com/Lightning-AI/lightning/pull/15443))
5151

52-
-
52+
- Fixed missing root flow among the flows of the app ([#15531](https://github.com/Lightning-AI/lightning/pull/15531))
5353

5454
-
5555

src/lightning_app/core/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def check_error_queue(self) -> None:
284284
@property
285285
def flows(self) -> List["LightningFlow"]:
286286
"""Returns all the flows defined within this application."""
287-
return list(self.root.flows.values())
287+
return [self.root] + list(self.root.flows.values())
288288

289289
@property
290290
def works(self) -> List[LightningWork]:

tests/tests_app/core/test_lightning_app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def test_nested_component_names():
219219

220220
def test_get_component_by_name():
221221
app = LightningApp(A())
222+
assert app.root in app.flows
222223
assert app.get_component_by_name("root") is app.root
223224
assert app.get_component_by_name("root.b") is app.root.b
224225
assert app.get_component_by_name("root.w_a") is app.root.w_a

tests/tests_app/utilities/test_load_app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def test_extract_metadata_from_component():
3030
app = load_app_from_file(os.path.join(test_script_dir, "app_metadata.py"))
3131
metadata = extract_metadata_from_app(app)
3232
assert metadata == [
33+
{"affiliation": ["root"], "cls_name": "RootFlow", "module": "__main__", "docstring": "RootFlow."},
3334
{
3435
"affiliation": ["root", "flow_a_1"],
3536
"cls_name": "FlowA",
@@ -41,7 +42,7 @@ def test_extract_metadata_from_component():
4142
"cls_name": "WorkA",
4243
"module": "__main__",
4344
"docstring": "WorkA.",
44-
"local_build_config": {"__build_config__": ANY},
45+
"local_build_config": {"__build_config__": {"requirements": [], "dockerfile": [], "image": None}},
4546
"cloud_build_config": {"__build_config__": {"requirements": [], "dockerfile": [], "image": None}},
4647
"cloud_compute": {
4748
"type": "__cloud_compute__",

0 commit comments

Comments
 (0)