Skip to content

Commit bacfbae

Browse files
committed
Load app before setting LIGHTNING_DISPATCHED (#16057)
1 parent 96c7397 commit bacfbae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lightning_app/runners/runtime.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ def dispatch(
5555
from lightning_app.runners.runtime_type import RuntimeType
5656
from lightning_app.utilities.component import _set_flow_context
5757

58-
# Used to indicate Lightning has been dispatched
59-
os.environ["LIGHTNING_DISPATCHED"] = "1"
60-
6158
_set_flow_context()
6259

6360
runtime_type = RuntimeType(runtime_type)
@@ -80,6 +77,8 @@ def dispatch(
8077
secrets=secrets,
8178
run_app_comment_commands=run_app_comment_commands,
8279
)
80+
# Used to indicate Lightning has been dispatched
81+
os.environ["LIGHTNING_DISPATCHED"] = "1"
8382
# a cloud dispatcher will return the result while local
8483
# dispatchers will be running the app in the main process
8584
return runtime.dispatch(open_ui=open_ui, name=name, no_cache=no_cache, cluster_id=cluster_id)

0 commit comments

Comments
 (0)