Skip to content

Commit 992ab73

Browse files
manskxBorda
authored andcommitted
partially cherry-pick #13602
1 parent d1b1df2 commit 992ab73

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.github/workflows/ci-app_cloud_e2e_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
shell: bash
156156
run: |
157157
mkdir -p ${VIDEO_LOCATION}
158-
HEADLESS=1 python -m pytest tests/tests_app_examples/test_${{ matrix.app_name }}.py::test_${{ matrix.app_name }}_example_cloud --timeout=900 --capture=no -v --color=yes
158+
HEADLESS=1 PACKAGE_LIGHTNING=1 python -m pytest tests/tests_app_examples/test_${{ matrix.app_name }}.py::test_${{ matrix.app_name }}_example_cloud --timeout=900 --capture=no -v --color=yes
159159
# Delete the artifacts if successful
160160
rm -r ${VIDEO_LOCATION}/${{ matrix.app_name }}
161161

src/lightning_app/core/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
REDIS_WARNING_QUEUE_SIZE = 1000
2323
USER_ID = os.getenv("USER_ID", "1234")
2424
FRONTEND_DIR = os.path.join(os.path.dirname(lightning_app.__file__), "ui")
25-
PREPARE_LIGHTING = bool(int(os.getenv("PREPARE_LIGHTING", "0")))
25+
PACKAGE_LIGHTNING = os.getenv("PACKAGE_LIGHTNING", None)
2626
LOCAL_LAUNCH_ADMIN_VIEW = bool(int(os.getenv("LOCAL_LAUNCH_ADMIN_VIEW", "0")))
2727
CLOUD_UPLOAD_WARNING = int(os.getenv("CLOUD_UPLOAD_WARNING", "2"))
2828
DISABLE_DEPENDENCY_CACHE = bool(int(os.getenv("DISABLE_DEPENDENCY_CACHE", "0")))

src/lightning_app/utilities/packaging/lightning_utils.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from lightning_app import _logger, _PROJECT_ROOT, _root_logger
1717
from lightning_app.__version__ import version
18-
from lightning_app.core.constants import PREPARE_LIGHTING
18+
from lightning_app.core.constants import PACKAGE_LIGHTNING
1919
from lightning_app.utilities.git import check_github_repository, get_dir_name
2020

2121
logger = logging.getLogger(__name__)
@@ -101,30 +101,34 @@ def _prepare_lightning_wheels_and_requirements(root: Path) -> Optional[Callable]
101101
# Packaging the Lightning codebase happens only inside the `lightning` repo.
102102
git_dir_name = get_dir_name() if check_github_repository() else None
103103

104-
if not PREPARE_LIGHTING and (not git_dir_name or (git_dir_name and not git_dir_name.startswith("lightning"))):
104+
is_lightning = git_dir_name and git_dir_name == "lightning"
105+
106+
if (PACKAGE_LIGHTNING is None and not is_lightning) or PACKAGE_LIGHTNING == "0":
105107
return
106-
if not bool(int(os.getenv("SKIP_LIGHTING_WHEELS_BUILD", "0"))):
107-
download_frontend(_PROJECT_ROOT)
108-
_prepare_wheel(_PROJECT_ROOT)
108+
109+
download_frontend(_PROJECT_ROOT)
110+
_prepare_wheel(_PROJECT_ROOT)
109111

110112
logger.info("Packaged Lightning with your application.")
111113

112114
tar_name = _copy_tar(_PROJECT_ROOT, root)
113115

114116
tar_files = [os.path.join(root, tar_name)]
115117

116-
# skipping this by default
117-
if not bool(int(os.getenv("SKIP_LIGHTING_UTILITY_WHEELS_BUILD", "1"))):
118+
# Don't skip by default
119+
if (PACKAGE_LIGHTNING or is_lightning) and not bool(int(os.getenv("SKIP_LIGHTING_UTILITY_WHEELS_BUILD", "0"))):
118120
# building and copying launcher wheel if installed in editable mode
119121
launcher_project_path = get_dist_path_if_editable_install("lightning_launcher")
120122
if launcher_project_path:
123+
logger.info("Packaged Lightning Launcher with your application.")
121124
_prepare_wheel(launcher_project_path)
122125
tar_name = _copy_tar(launcher_project_path, root)
123126
tar_files.append(os.path.join(root, tar_name))
124127

125128
# building and copying lightning-cloud wheel if installed in editable mode
126129
lightning_cloud_project_path = get_dist_path_if_editable_install("lightning_cloud")
127130
if lightning_cloud_project_path:
131+
logger.info("Packaged Lightning Cloud with your application.")
128132
_prepare_wheel(lightning_cloud_project_path)
129133
tar_name = _copy_tar(lightning_cloud_project_path, root)
130134
tar_files.append(os.path.join(root, tar_name))

0 commit comments

Comments
 (0)