From fc8dab30be5c4b6174732b45796431b65b6e95e2 Mon Sep 17 00:00:00 2001 From: Akihiro Nitta Date: Thu, 15 Dec 2022 17:56:27 +0900 Subject: [PATCH] Revert "Load app before setting LIGHTNING_DISPATCHED (#16057)" This reverts commit 8d3339a0e99ed91871e0c4f7214aca1146e95a89. --- src/lightning_app/runners/runtime.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lightning_app/runners/runtime.py b/src/lightning_app/runners/runtime.py index a30b78f9178a0..ab552f136fde0 100644 --- a/src/lightning_app/runners/runtime.py +++ b/src/lightning_app/runners/runtime.py @@ -55,6 +55,9 @@ def dispatch( from lightning_app.runners.runtime_type import RuntimeType from lightning_app.utilities.component import _set_flow_context + # Used to indicate Lightning has been dispatched + os.environ["LIGHTNING_DISPATCHED"] = "1" + _set_flow_context() runtime_type = RuntimeType(runtime_type) @@ -77,8 +80,6 @@ def dispatch( secrets=secrets, run_app_comment_commands=run_app_comment_commands, ) - # Used to indicate Lightning has been dispatched - os.environ["LIGHTNING_DISPATCHED"] = "1" # a cloud dispatcher will return the result while local # dispatchers will be running the app in the main process return runtime.dispatch(open_ui=open_ui, name=name, no_cache=no_cache, cluster_id=cluster_id)