Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load the app before setting LIGHTNING_DISPATCHED #16071

Merged
merged 3 commits into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/lightning_app/runners/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ 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)
Expand All @@ -80,6 +77,8 @@ 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)
Expand Down