Skip to content

Commit 6a39743

Browse files
BordalantigatchatonakihironittaLiyang90
authored
Releasing/1.8.4.post (#15988)
* Apply dynamo to training_step, validation_step, test_step, predict_step (#15957) * Apply dynamo to training_step, validation_step, test_step, predict_step * Add entry to CHANGELOG.md (cherry picked from commit edc9986) * [App] Resolve run installation (#15974) (cherry picked from commit dd83587) * App: Move AutoScaler dependency to extra requirements (#15971) * Make autoscaler dependency optional * update chglog * dont directly import aiohttp (cherry picked from commit 346e936) # Conflicts: # requirements/app/base.txt # src/lightning_app/CHANGELOG.md * Avoid using the same port number for autoscaler works (#15966) * dont hardcode port in python server * add another chglog (cherry picked from commit a72d268) * Fix `action_name` usage in `XLAProfiler` (#15886) * Fix `action_name` usage in `XLAProfiler` * add changelog * Update src/pytorch_ligh * Update xla.py Co-authored-by: awaelchli <[email protected]> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit c748f82) * Fix multinode cloud component (#15965) * fix multinode cloud component * add tests (cherry picked from commit d21b899) * ci: update signaling (#15981) * ci: update signaling * config (cherry picked from commit e56e7f1) * Fix cloudcomputes registration for structures (#15964) * fix cloudcomputes * updates cloudcompute registration * changelog (cherry picked from commit 90a4c02) * Document running dev lightning on the cloud (#15962) * document running dev lightning on the cloud * document running dev lightning on the cloud * Update .github/CONTRIBUTING.md Co-authored-by: Noha Alon <[email protected]> * document running dev lightning on the cloud * git clone & pip install -e * Update .github/CONTRIBUTING.md Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Noha Alon <[email protected]> Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit cfd00d3) * [App] Install exact version whn upgrading and not when testing (#15984) * [App] Install exact version whn upgrading and not when testing * Update CHANGELOG.md Co-authored-by: Jirka Borovec <[email protected]> (cherry picked from commit 1657ea8) * releasing 1.8.4.post0 Co-authored-by: Luca Antiga <[email protected]> Co-authored-by: thomas chaton <[email protected]> Co-authored-by: Akihiro Nitta <[email protected]> Co-authored-by: Liyang90 <[email protected]> Co-authored-by: Justus Schock <[email protected]> Co-authored-by: Ethan Harris <[email protected]>
1 parent 7eb5ff5 commit 6a39743

File tree

31 files changed

+223
-69
lines changed

31 files changed

+223
-69
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,20 @@ and the last true master commit is `ccc111` and your first commit is `mmm222`.
309309
git push -f
310310
```
311311

312+
#### How to run an app on the cloud with a local version of lightning
313+
314+
The lightning cloud uses the latest release by default. However, you might want to run your app with some local changes you've made to the lightning framework. To use your local version of lightning on the cloud, set the following environment variable:
315+
316+
```bash
317+
git clone https://github.com/Lightning-AI/lightning.git
318+
cd lightning
319+
pip install -e .
320+
export PACKAGE_LIGHTNING=1 # <- this is the magic to use your version (not mainstream PyPI)!
321+
lightning run app app.py --cloud
322+
```
323+
324+
By seting `PACKAGE_LIGHTNING=1`, lightning packages the lightning source code in your local directory in addition to your app source code and uploads them to the cloud.
325+
312326
### Bonus Workflow Tip
313327

314328
If you don't want to remember all the commands above every time you want to push some code/setup a Lightning Dev environment on a new VM, you can set up bash aliases for some common commands. You can add these to one of your `~/.bashrc`, `~/.zshrc`, or `~/.bash_aliases` files.

.github/workflows/release-pypi.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ defaults:
1212
shell: bash
1313

1414
jobs:
15+
1516
init:
1617
runs-on: ubuntu-20.04
1718
steps:
@@ -23,6 +24,7 @@ jobs:
2324
name: dist-packages-${{ github.sha }}
2425
path: dist
2526

27+
2628
build-packages:
2729
needs: init
2830
runs-on: ubuntu-20.04
@@ -40,22 +42,20 @@ jobs:
4042
- uses: actions/setup-python@v4
4143
with:
4244
python-version: 3.9
43-
4445
- name: Install dependencies
4546
run: pip install -U setuptools wheel
46-
4747
- name: Build packages
4848
env:
4949
PACKAGE_NAME: ${{ matrix.pkg-name }}
5050
run: |
5151
python setup.py sdist bdist_wheel
5252
ls -lh dist/
53-
5453
- uses: actions/upload-artifact@v3
5554
with:
5655
name: dist-packages-${{ github.sha }}
5756
path: dist
5857

58+
5959
upload-packages:
6060
runs-on: ubuntu-20.04
6161
needs: build-packages
@@ -73,6 +73,7 @@ jobs:
7373
files: 'dist/*'
7474
repo-token: ${{ secrets.GITHUB_TOKEN }}
7575

76+
7677
release-version:
7778
runs-on: ubuntu-20.04
7879
outputs:
@@ -87,6 +88,7 @@ jobs:
8788
id: lai-package
8889
run: python -c "import lightning as L; print(f'version={L.__version__}')" >> $GITHUB_OUTPUT
8990

91+
9092
signaling:
9193
runs-on: ubuntu-20.04
9294
needs: [release-version]
@@ -100,12 +102,6 @@ jobs:
100102
with:
101103
repository: gridai/base-images
102104
token: ${{ secrets.PAT_GHOST }}
103-
ref: main
104-
- uses: fregante/setup-git-token@v1
105-
with:
106-
token: ${{ secrets.PAT_GHOST }}
107-
name: PL Ghost
108-
109105
- name: Update lightning version
110106
run: |
111107
import json, os
@@ -115,20 +111,21 @@ jobs:
115111
with open("versions.json", "w") as fw:
116112
json.dump(vers, fw)
117113
shell: python
118-
- name: GIT Commit
114+
- run: cat versions.json
115+
- name: GIT commit & push
116+
env:
117+
BRANCH_NAME: "trigger/lightning-${{ env.TAG }}"
119118
run: |
119+
git config --global user.name "PL Ghost"
120+
git config --global user.email [email protected]
121+
git checkout -b ${BRANCH_NAME}
120122
git add versions.json
121-
git commit -m "bumping lightning version -> ${TAG}"
122-
cat versions.json
123-
- name: GIT Push
124-
run: |
125123
git status
126-
# force push is not very nice
127-
# but so far the push is rejected even with exception for this user
128-
git push -f
124+
git commit -m "bumping lightning version -> ${TAG}"
125+
git push -u origin ${BRANCH_NAME} -f
126+
129127
130128
waiting:
131-
# TODO: replace with back signal from build images/ loop checking for a specific branch?
132129
runs-on: ubuntu-20.04
133130
needs: [release-version, signaling]
134131
env:
@@ -152,6 +149,7 @@ jobs:
152149
time.sleep(60)
153150
shell: python
154151

152+
155153
pre-publish-packages:
156154
runs-on: ubuntu-20.04
157155
needs: build-packages
@@ -181,6 +179,7 @@ jobs:
181179
pkg-pattern: "*"
182180
pypi-test-token: ${{ secrets.PYPI_TEST_TOKEN_LAI }}
183181

182+
184183
publish-packages:
185184
runs-on: ubuntu-20.04
186185
needs: [build-packages, waiting]
@@ -210,6 +209,7 @@ jobs:
210209
pkg-pattern: "*"
211210
pypi-token: ${{ secrets.PYPI_TOKEN_LAI }}
212211

212+
213213
legacy-checkpoints:
214214
needs: [build-packages]
215215
uses: ./.github/workflows/legacy-checkpoints.yml

examples/app_server_with_auto_scaler/app.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ! pip install torch torchvision
12
from typing import Any, List
23

34
import torch
@@ -22,10 +23,10 @@ class BatchResponse(BaseModel):
2223
class PyTorchServer(L.app.components.PythonServer):
2324
def __init__(self, *args, **kwargs):
2425
super().__init__(
25-
port=L.app.utilities.network.find_free_network_port(),
2626
input_type=BatchRequestModel,
2727
output_type=BatchResponse,
28-
cloud_compute=L.CloudCompute("gpu"),
28+
*args,
29+
**kwargs,
2930
)
3031

3132
def setup(self):
@@ -57,30 +58,32 @@ def scale(self, replicas: int, metrics: dict) -> int:
5758
"""The default scaling logic that users can override."""
5859
# scale out if the number of pending requests exceeds max batch size.
5960
max_requests_per_work = self.max_batch_size
60-
pending_requests_per_running_or_pending_work = metrics["pending_requests"] / (
61-
replicas + metrics["pending_works"]
62-
)
63-
if pending_requests_per_running_or_pending_work >= max_requests_per_work:
61+
pending_requests_per_work = metrics["pending_requests"] / (replicas + metrics["pending_works"])
62+
if pending_requests_per_work >= max_requests_per_work:
6463
return replicas + 1
6564

6665
# scale in if the number of pending requests is below 25% of max_requests_per_work
6766
min_requests_per_work = max_requests_per_work * 0.25
68-
pending_requests_per_running_work = metrics["pending_requests"] / replicas
69-
if pending_requests_per_running_work < min_requests_per_work:
67+
pending_requests_per_work = metrics["pending_requests"] / replicas
68+
if pending_requests_per_work < min_requests_per_work:
7069
return replicas - 1
7170

7271
return replicas
7372

7473

7574
app = L.LightningApp(
7675
MyAutoScaler(
76+
# work class and args
7777
PyTorchServer,
78-
min_replicas=2,
78+
cloud_compute=L.CloudCompute("gpu"),
79+
# autoscaler specific args
80+
min_replicas=1,
7981
max_replicas=4,
8082
autoscale_interval=10,
8183
endpoint="predict",
8284
input_type=RequestModel,
8385
output_type=Any,
8486
timeout_batching=1,
87+
max_batch_size=8,
8588
)
8689
)

requirements/app/base.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ beautifulsoup4>=4.8.0, <4.11.2
1212
inquirer>=2.10.0
1313
psutil<5.9.4
1414
click<=8.1.3
15-
s3fs>=2022.5.0, <2022.8.3
16-
aiohttp>=3.8.0, <=3.8.3

requirements/app/cloud.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
redis>=4.0.1, <=4.2.4
44
docker>=5.0.0, <=5.0.3
55
# setuptools==59.5.0
6+
s3fs>=2022.5.0, <2022.8.3
7+
aiohttp>=3.8.0, <=3.8.3

requirements/app/components.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# deps required by components in the lightning app repository (src/lightning_app/components)
22
lightning_api_access>=0.0.3
3+
aiohttp>=3.8.0, <=3.8.3

src/lightning/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.8.4"
1+
version = "1.8.4.post0"

src/lightning_app/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1313
- Added the CLI command `lightning delete app` to delete a lightning app on the cloud ([#15783](https://github.com/Lightning-AI/lightning/pull/15783))
1414
- Added a CloudMultiProcessBackend which enables running a child App from within the Flow in the cloud ([#15800](https://github.com/Lightning-AI/lightning/pull/15800))
1515
- Utility for pickling work object safely even from a child process ([#15836](https://github.com/Lightning-AI/lightning/pull/15836))
16-
- Added `AutoScaler` component ([#15769](https://github.com/Lightning-AI/lightning/pull/15769))
16+
- Added `AutoScaler` component (
17+
[#15769](https://github.com/Lightning-AI/lightning/pull/15769),
18+
[#15971](https://github.com/Lightning-AI/lightning/pull/15971),
19+
[#15966](https://github.com/Lightning-AI/lightning/pull/15966)
20+
)
1721
- Added the property `ready` of the LightningFlow to inform when the `Open App` should be visible ([#15921](https://github.com/Lightning-AI/lightning/pull/15921))
1822
- Added private work attributed `_start_method` to customize how to start the works ([#15923](https://github.com/Lightning-AI/lightning/pull/15923))
1923
- Added a `configure_layout` method to the `LightningWork` which can be used to control how the work is handled in the layout of a parent flow ([#15926](https://github.com/Lightning-AI/lightning/pull/15926))
@@ -50,6 +54,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
5054
- Fixed multiprocessing breakpoint ([#15950](https://github.com/Lightning-AI/lightning/pull/15950))
5155
- Fixed detection of a Lightning App running in debug mode ([#15951](https://github.com/Lightning-AI/lightning/pull/15951))
5256
- Fixed `ImportError` on Multinode if package not present ([#15963](https://github.com/Lightning-AI/lightning/pull/15963))
57+
- Fixed MultiNode Component to use separate cloud computes ([#15965](https://github.com/Lightning-AI/lightning/pull/15965))
58+
- Fixed Registration for CloudComputes of Works in `L.app.structures` ([#15964](https://github.com/Lightning-AI/lightning/pull/15964))
59+
- Fixed a bug where auto-upgrading to the latest lightning via the CLI could get stuck in a loop ([#15984](https://github.com/Lightning-AI/lightning/pull/15984))
60+
5361

5462
## [1.8.3] - 2022-11-22
5563

src/lightning_app/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.8.4"
1+
version = "1.8.4.post0"

src/lightning_app/cli/cmd_install.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def gallery_apps_and_components(
101101
except Exception:
102102
return None
103103

104-
entry, kind = _resolve_entry(app_or_component, version_arg)
104+
entry, kind = _resolve_entry(name, version_arg)
105105

106106
if kind == "app":
107107
# give the user the chance to do a manual install
@@ -111,16 +111,19 @@ def gallery_apps_and_components(
111111
# run installation if requested
112112
_install_app_from_source(source_url, git_url, folder_name, cwd=cwd, overwrite=overwrite, git_sha=git_sha)
113113

114-
return os.path.join(os.getcwd(), folder_name, entry["appEntrypointFile"])
114+
return os.path.join(os.getcwd(), *entry["appEntrypointFile"].split("/"))
115115

116116
elif kind == "component":
117117
# give the user the chance to do a manual install
118-
git_url = _show_install_component_prompt(entry, app_or_component, org, yes_arg)
119-
118+
source_url, git_url, folder_name, git_sha = _show_install_app_prompt(
119+
entry, app_or_component, org, yes_arg, resource_type="component"
120+
)
121+
if "@" in git_url:
122+
git_url = git_url.split("git+")[1].split("@")[0]
120123
# run installation if requested
121-
_install_component_from_source(git_url)
124+
_install_app_from_source(source_url, git_url, folder_name, cwd=cwd, overwrite=overwrite, git_sha=git_sha)
122125

123-
return os.path.join(os.getcwd(), entry["appEntrypointFile"])
126+
return os.path.join(os.getcwd(), *entry["entrypointFile"].split("/"))
124127

125128
return None
126129

0 commit comments

Comments
 (0)