Skip to content

Commit 36181a6

Browse files
[Tests] Add options for test to select clouds (skypilot-org#1587)
* Add options for test to select clouds * strip image_id * strip * not error out if azure status not exist * fix gcp images * reduce test name * format * fix * fix gcp tests * name length * Fix smoke test * fix gcp region * use west3 * fix some more tests * use ubuntu instead * fix name * fix * Only refresh status for cluster * remnant * add spot queue waiting * revert gcp * use ":" instead for gcloud * fix launch hash filter str * Use our own lsof to avoid not installed issue * instruction for rerun failed tests * spot queue left * fix templates * wait longer for autostop * Fix autodown test * adopt the mylsof to azure * lint * change zone * format * reduce test name length * wait longer for autostop * longer autostop * fix format exception * shorter cluster name * Update CONTRIBUTING.md Co-authored-by: Zongheng Yang <[email protected]> * address comments * format * contributing * Document * pyproject * revert gcloud filter * fix * fix * format * fix test_smoke matching * fix * reduce length * reduce cluster name length * increase cancel wait time * Reset the meaning of --cloud * fix comment * format * address comments * yapf Co-authored-by: Zongheng Yang <[email protected]>
1 parent 983f5fa commit 36181a6

31 files changed

+720
-279
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
Tested (run the relevant ones):
99

1010
- [ ] Any manual or new tests for this PR (please specify below)
11-
- [ ] All smoke tests: `bash tests/run_smoke_tests.sh`
12-
- [ ] Relevant individual smoke tests: `bash tests/run_smoke_tests.sh test_fill_in_the_name`
11+
- [ ] All smoke tests: `pytest tests/test_smoke.py`
12+
- [ ] Relevant individual smoke tests: `pytest tests/test_smoke.py::test_fill_in_the_name`
1313
- [ ] Backward compatibility tests: `bash tests/backward_comaptibility_tests.sh`

CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ pip install -r requirements-dev.txt
2626
### Testing
2727
To run smoke tests (NOTE: Running all smoke tests launches ~20 clusters):
2828
```
29-
bash tests/run_smoke_tests.sh
29+
# Run all tests except for AWS
30+
pytest tests/test_smoke.py
31+
32+
# Re-run last failed tests
33+
pytest --lf
3034
3135
# Run one of the smoke tests
32-
bash tests/run_smoke_tests.sh test_minimal
36+
pytest tests/test_smoke.py::test_minimal
37+
38+
# Only run test for AWS + generic tests
39+
pytest tests/test_smoke.py --aws
40+
41+
# Change cloud for generic tests to aws
42+
pytest tests/test_smoke.py --generic-cloud aws
3343
```
3444

3545
For profiling code, use:

examples/env_check.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
resources:
2-
cloud: aws
3-
41
num_nodes: 2
52

63
workdir: .

examples/job_queue/cluster.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
# sky exec jq job.yaml
88

99
resources:
10-
cloud: aws
1110
accelerators: K80

examples/job_queue/cluster_multinode.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# sky exec mjq job.yaml
99

1010
resources:
11-
cloud: aws
1211
accelerators: T4
1312

1413
num_nodes: 2

examples/job_queue/job_multinode.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ setup: |
2121
run: |
2222
timestamp=$(date +%s)
2323
conda env list
24-
for i in {1..240}; do
24+
for i in {1..360}; do
2525
echo "$timestamp $i"
2626
sleep 1
2727
done

examples/managed_spot.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
name: minimal
22

3-
resources:
4-
cloud: aws
5-
use_spot: true
6-
spot_recovery: failover
7-
83
setup: |
94
echo "running setup"
105
pip install tqdm

examples/multi_echo.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sky
99

1010

11-
def run(cluster: Optional[str] = None):
11+
def run(cluster: Optional[str] = None, cloud: Optional[str] = None):
1212
if cluster is None:
1313
# (username, last 4 chars of hash of hostname): for uniquefying users on
1414
# shared-account cloud providers.
@@ -17,9 +17,13 @@ def run(cluster: Optional[str] = None):
1717
_user_and_host = f'{getpass.getuser()}-{hostname_hash}'
1818
cluster = f'test-multi-echo-{_user_and_host}'
1919

20+
if cloud is None:
21+
cloud = 'gcp'
22+
cloud = sky.clouds.CLOUD_REGISTRY.from_str(cloud)
23+
2024
# Create the cluster.
2125
with sky.Dag() as dag:
22-
cluster_resources = sky.Resources(sky.AWS(), accelerators={'K80': 1})
26+
cluster_resources = sky.Resources(cloud, accelerators={'K80': 1})
2327
task = sky.Task(num_nodes=2).set_resources(cluster_resources)
2428
# `detach_run` will only detach the `run` command. The provision and
2529
# `setup` are still blocking.
@@ -38,7 +42,10 @@ def _exec(i):
3842

3943
if __name__ == '__main__':
4044
cluster = None
45+
cloud = None
4146
if len(sys.argv) > 1:
4247
# For smoke test passing in a cluster name.
4348
cluster = sys.argv[1]
44-
run(cluster)
49+
if len(sys.argv) > 2:
50+
cloud = sys.argv[2]
51+
run(cluster, cloud)

examples/multi_hostname.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: multi_hostname
22

3-
resources:
4-
cloud: gcp
5-
63
num_nodes: 2
74

85
# The run command will be run on *all* nodes.

examples/per_region_images.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
resources:
22
cloud: aws
3+
instance_type: g4dn.xlarge
34
image_id:
4-
us-east-1: ami-0729d913a335efca7 # Ubuntu 20.04
5+
us-west-2: ami-0fe5af21074ad2a10 # Deep learning AMI with CUDA 11.6 without conda installed
56
us-west-1: skypilot:gpu-ubuntu-1804
67

78

@@ -10,3 +11,4 @@ setup: |
1011
1112
run: |
1213
conda env list
14+
nvidia-smi

0 commit comments

Comments
 (0)