Skip to content

Commit 62cb1de

Browse files
carmoccalexierule
authored andcommitted
Add path filters for azure PR jobs (#14544)
1 parent 8c26b9c commit 62cb1de

File tree

3 files changed

+286
-2
lines changed

3 files changed

+286
-2
lines changed

.azure/app-cloud-e2e.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
tags:
8+
include:
9+
- '*'
10+
branches:
11+
include:
12+
- "master"
13+
- "release/*"
14+
- "refs/tags/*"
15+
paths:
16+
include:
17+
- ".azure/app-cloud-e2e.yml"
18+
- "requirements/app/**"
19+
- "src/lightning_app/**"
20+
- "examples/app_*"
21+
22+
pr:
23+
branches:
24+
include:
25+
- "master"
26+
- "release/*"
27+
paths:
28+
include:
29+
- ".azure/app-cloud-e2e.yml"
30+
- "requirements/app/**"
31+
- "src/lightning_app/**"
32+
- "examples/app_*"
33+
34+
# variables are automatically exported as environment variables so this will override pip's default cache dir
35+
variables:
36+
- name: pip_cache_dir
37+
value: $(Pipeline.Workspace)/.pip
38+
- name: local_id
39+
value: $(Build.BuildId)
40+
41+
jobs:
42+
- job: App_cloud_e2e_testing
43+
pool: azure-cpus
44+
container:
45+
image: mcr.microsoft.com/playwright/python:v1.25.2-focal
46+
options: "--shm-size=2g"
47+
strategy:
48+
matrix:
49+
'App: v0_app':
50+
name: "v0_app"
51+
'App: boring_app':
52+
name: "boring_app"
53+
'App: template_streamlit_ui':
54+
name: "template_streamlit_ui"
55+
'App: template_react_ui':
56+
name: "template_react_ui"
57+
'App: template_jupyterlab': # TODO: clarify where these files lives
58+
name: "template_jupyterlab"
59+
'App: idle_timeout':
60+
name: "idle_timeout"
61+
'App: collect_failures':
62+
name: "collect_failures"
63+
'App: custom_work_dependencies':
64+
name: "custom_work_dependencies"
65+
'App: drive':
66+
name: "drive"
67+
'App: payload':
68+
name: "payload"
69+
'App: commands_and_api':
70+
name: "commands_and_api"
71+
timeoutInMinutes: "30"
72+
cancelTimeoutInMinutes: "2"
73+
# values: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#workspace
74+
workspace:
75+
clean: all
76+
steps:
77+
78+
- script: echo '##vso[task.setvariable variable=local_id]$(System.PullRequest.PullRequestNumber)'
79+
displayName: "Set id for this PR"
80+
condition: eq(variables['Build.Reason'], 'PullRequest')
81+
82+
- bash: |
83+
whoami
84+
printf "local id: $(local_id)\n"
85+
python --version
86+
pip --version
87+
displayName: 'Info'
88+
89+
- task: Cache@2
90+
inputs:
91+
key: 'pip | "$(name)" | requirements/app/base.txt'
92+
restoreKeys: |
93+
pip | "$(Agent.OS)"
94+
path: $(pip_cache_dir)
95+
displayName: Cache pip
96+
97+
- bash: python -m pip install -r requirements/app/devel.txt --quiet --find-links ${TORCH_URL}
98+
env:
99+
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html
100+
displayName: 'Install dependencies'
101+
102+
- bash: |
103+
python -m pip install playwright
104+
python -m playwright install # --with-deps
105+
displayName: 'Install Playwright system dependencies'
106+
107+
- bash: pip install -e . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
108+
displayName: 'Install lightning'
109+
110+
- bash: |
111+
git clone https://github.com/Lightning-AI/LAI-lightning-template-jupyterlab-App examples/app_template_jupyterlab
112+
cp examples/app_template_jupyterlab/tests/test_template_jupyterlab.py tests/tests_app_examples/test_template_jupyterlab.py
113+
condition: eq(variables['name'], 'template_jupyterlab')
114+
displayName: 'Clone Template Jupyter Lab Repo'
115+
116+
- bash: git clone https://github.com/Lightning-AI/lightning-template-react examples/app_template_react_ui
117+
condition: eq(variables['name'], 'template_react_ui')
118+
displayName: 'Clone Template React UI Repo'
119+
120+
- bash: |
121+
mkdir -p ${VIDEO_LOCATION}
122+
ls -l examples/${TEST_APP_NAME}
123+
ls -l tests/tests_app_examples
124+
python -m pytest tests/tests_app_examples/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud --timeout=900 --capture=no -v --color=yes
125+
env:
126+
HEADLESS: '1'
127+
PACKAGE_LIGHTNING: '1'
128+
CLOUD: '1'
129+
VIDEO_LOCATION: '$(Build.ArtifactStagingDirectory)/videos'
130+
PR_NUMBER: $(local_id)
131+
TEST_APP_NAME: $(name)
132+
HAR_LOCATION: './artifacts/hars'
133+
SLOW_MO: '50'
134+
# LAI_USER: $(LAI_USER)
135+
# LAI_PASS: $(LAI_PASS)
136+
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
137+
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
138+
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
139+
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
140+
displayName: 'Run the tests'
141+
142+
- publish: '$(Build.ArtifactStagingDirectory)/videos'
143+
condition: failed()
144+
displayName: 'Publish videos'
145+
artifact: $(name)
146+
147+
- bash: |
148+
time python -c "from lightning.app import testing; testing.delete_cloud_lightning_apps()"
149+
condition: always()
150+
env:
151+
# LAI_USER: $(LAI_USER)
152+
# LAI_PASS: $(LAI_PASS)
153+
LIGHTNING_USER_ID: $(LIGHTNING_USER_ID_PROD)
154+
LIGHTNING_API_KEY: $(LIGHTNING_API_KEY_PROD)
155+
LIGHTNING_USERNAME: $(LIGHTNING_USERNAME)
156+
LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD)
157+
PR_NUMBER: $(local_id)
158+
TEST_APP_NAME: $(name)
159+
# GRID_USER_ID: $(LIGHTNING_USER_ID) # TODO: clarify the meaning
160+
# GRID_USER_KEY: $(LIGHTNING_API_KEY) # TODO: clarify the meaning
161+
# GRID_URL: $(LIGHTNING_CLOUD_URL)
162+
# _GRID_USERNAME: $(LIGHTNING_USERNAME)
163+
displayName: 'Clean Previous Apps'

.azure/gpu-tests-lite.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
tags:
8+
include:
9+
- '*'
10+
branches:
11+
include:
12+
- "master"
13+
- "release/*"
14+
- "refs/tags/*"
15+
paths:
16+
include:
17+
- ".azure/gpu-tests-lite.yml"
18+
- "requirements/lite/**"
19+
- "src/lightning_lite/**"
20+
- "tests/tests_lite/**"
21+
- "tests/tests_pytorch/run_standalone_tests.sh"
22+
- "tests/tests_lite/run_standalone_tests.sh" # a symlink to the one above
23+
24+
pr:
25+
branches:
26+
include:
27+
- "master"
28+
- "release/*"
29+
paths:
30+
include:
31+
- ".azure/gpu-tests-lite.yml"
32+
- "requirements/lite/**"
33+
- "src/lightning_lite/**"
34+
- "tests/tests_lite/**"
35+
- "tests/tests_pytorch/run_standalone_tests.sh"
36+
- "tests/tests_lite/run_standalone_tests.sh" # a symlink to the one above
37+
38+
jobs:
39+
- job: testing
40+
# how long to run the job before automatically cancelling
41+
timeoutInMinutes: "20"
42+
# how much time to give 'run always even if cancelled tasks' before stopping them
43+
cancelTimeoutInMinutes: "2"
44+
pool: azure-jirka-spot
45+
container:
46+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.9-torch1.12-cuda11.6.1"
47+
# default shm size is 64m. Increase it to avoid:
48+
# 'Error while creating shared memory: unhandled system error, NCCL version 2.7.8'
49+
options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --shm-size=512m"
50+
workspace:
51+
clean: all
52+
53+
steps:
54+
- bash: |
55+
lspci | egrep 'VGA|3D'
56+
whereis nvidia
57+
nvidia-smi
58+
which python && which pip
59+
python --version
60+
pip --version
61+
pip list
62+
displayName: 'Image info & NVIDIA'
63+
64+
- bash: |
65+
set -e
66+
TORCH_VERSION=$(python -c "import torch; print(torch.__version__.split('+')[0])")
67+
CUDA_VERSION_MM=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
68+
python ./requirements/pytorch/adjust-versions.py requirements/lite/base.txt ${PYTORCH_VERSION}
69+
pip install -e .[strategies] --find-links https://download.pytorch.org/whl/cu${CUDA_VERSION_MM}/torch_stable.html
70+
pip install --requirement requirements/pytorch/devel.txt --find-links https://download.pytorch.org/whl/cu${CUDA_VERSION_MM}/torch_stable.html
71+
pip list
72+
env:
73+
PACKAGE_NAME: pytorch
74+
FREEZE_REQUIREMENTS: 1
75+
displayName: 'Install dependencies'
76+
77+
- bash: |
78+
set -e
79+
python requirements/collect_env_details.py
80+
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
81+
displayName: 'Env details'
82+
83+
- bash: python -m coverage run --source lightning_lite -m pytest --ignore benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
84+
env:
85+
PL_RUN_CUDA_TESTS: "1"
86+
workingDirectory: tests/tests_lite
87+
displayName: 'Testing: Lite standard'
88+
timeoutInMinutes: "10"
89+
90+
- bash: bash run_standalone_tests.sh
91+
workingDirectory: tests/tests_lite
92+
env:
93+
PL_RUN_CUDA_TESTS: "1"
94+
PL_STANDALONE_TESTS_SOURCE: "lightning_lite"
95+
displayName: 'Testing: Lite standalone tests'
96+
timeoutInMinutes: "10"
97+
98+
- bash: |
99+
python -m coverage report
100+
python -m coverage xml
101+
python -m coverage html
102+
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
103+
ls -l
104+
workingDirectory: tests/tests_lite
105+
displayName: 'Statistics'
106+
107+
- task: PublishTestResults@2
108+
displayName: 'Publish test results'
109+
inputs:
110+
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
111+
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
112+
condition: succeededOrFailed()

.azure/hpu-tests.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ trigger:
1111
- "refs/tags/*"
1212

1313
pr:
14-
- "master"
15-
- "release/*"
14+
branches:
15+
include:
16+
- "master"
17+
- "release/*"
18+
paths:
19+
include:
20+
- ".azure/hpu-tests.yml"
21+
- "examples/pl_hpu/mnist_sample.py"
22+
- "requirements/pytorch/**"
23+
- "src/pytorch_lightning/**"
24+
- "tests/tests_pytorch/**"
1625

1726
jobs:
1827
- job: testing

0 commit comments

Comments
 (0)