[App] Resolve race condition to move ui files ()

This commit is contained in:
thomas chaton 2022-11-11 10:15:12 +00:00 committed by GitHub
parent 75b5042081
commit 2f0c0396b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions
src/lightning_app

View File

@ -68,6 +68,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed an issue with the `lightning` CLI taking a long time to error out when the cloud is not reachable ([#15412](https://github.com/Lightning-AI/lightning/pull/15412))
- Fixed race condition to over-write the frontend with app infos ([#15398](https://github.com/Lightning-AI/lightning/pull/15398))
## [1.8.0] - 2022-11-01

View File

@ -100,6 +100,7 @@ class LightningApp:
"""
self.root_path = root_path # when running behind a proxy
self.info = info
from lightning_app.core.flow import _RootFlow
@ -168,9 +169,10 @@ class LightningApp:
logger.debug(f"ENV: {os.environ}")
def _update_index_file(self):
# update index.html,
# this should happen once for all apps before the ui server starts running.
frontend.update_index_file(FRONTEND_DIR, info=info, root_path=root_path)
frontend.update_index_file(FRONTEND_DIR, info=self.info, root_path=self.root_path)
if _should_dispatch_app():
os.environ["LIGHTNING_DISPATCHED"] = "1"

View File

@ -99,6 +99,7 @@ class CloudRuntime(Runtime):
app_config = AppConfig.load_from_file(config_file) if config_file else AppConfig()
root = config_file.parent if config_file else Path(self.entrypoint_file).absolute().parent
cleanup_handle = _prepare_lightning_wheels_and_requirements(root)
self.app._update_index_file()
repo = LocalSourceCodeDir(path=root)
self._check_uploaded_folder(root, repo)
requirements_file = root / "requirements.txt"

View File

@ -30,9 +30,11 @@ class MultiProcessRuntime(Runtime):
"""Method to dispatch and run the LightningApp."""
try:
_set_flow_context()
self.app.backend = self.backend
self.backend._prepare_queues(self.app)
self.backend.resolve_url(self.app, "http://127.0.0.1")
self.app._update_index_file()
# set env variables
os.environ.update(self.env_vars)