pytest-modal 0.0.2__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/CHANGELOG.md +4 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/PKG-INFO +23 -86
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/README.md +22 -85
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/pyproject.toml +1 -1
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/.gitignore +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/LICENSE +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/conftest.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/test_mixed.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/test_wait_a.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/test_wait_b.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/test_wait_c.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/example/test_wait_d.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/__init__.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/_common.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/backends.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/hookspecs.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/plan.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/plugin.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/src/pytest_modal/worker.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/conftest.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/live/conftest.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/live/test_fork.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/live/test_lifetime.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/live/test_upload.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_backends.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_collect.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_coverage.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_failures.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_fixtures.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_image.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_plan.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_plugin.py +0 -0
- {pytest_modal-0.0.2 → pytest_modal-0.0.3}/tests/test_weights.py +0 -0
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
What changed in each release of pytest-modal, newest first. While the version starts with 0, any release
|
|
4
4
|
may change options and behaviour.
|
|
5
5
|
|
|
6
|
+
## 0.0.3
|
|
7
|
+
|
|
8
|
+
The README gives CLI flags more room and compares plain pytest and pytest-modal timings in a compact benchmark table.
|
|
9
|
+
|
|
6
10
|
## 0.0.2
|
|
7
11
|
|
|
8
12
|
The PyPI README now includes the revised quickstart, CI credential setup, and tables of CLI flags and configuration options.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pytest-modal
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Run a pytest session's tests across Modal sandboxes
|
|
5
5
|
Project-URL: Homepage, https://github.com/wikipika-modal/pytest-modal
|
|
6
6
|
Project-URL: Documentation, https://github.com/wikipika-modal/pytest-modal#readme
|
|
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
# pytest-modal
|
|
30
30
|
|
|
31
31
|
Run a pytest session's tests across [Modal](https://modal.com) sandboxes with `--modal`. Useful for CI and remote-exec workflows I reckon.
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
Currently in alpha!
|
|
34
34
|
|
|
35
35
|
## Quickstart
|
|
@@ -63,19 +63,6 @@ modal: test_b.py took 5.0s of the 7.1s; --modal-group-by=test would split its te
|
|
|
63
63
|
============================= 20 passed in 13.03s ==============================
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
`pytest --modal --modal-backend=local` shards over local subprocesses
|
|
67
|
-
instead (skips Modal account requirement).
|
|
68
|
-
|
|
69
|
-
Some more flags below:
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
--modal-shards=8 # exact shard count
|
|
73
|
-
--modal-max-shards=8 # cap auto concurrency
|
|
74
|
-
--modal-group-by=test # split inside files too
|
|
75
|
-
--modal-collect=local|remote # discover tests locally or in a sandbox
|
|
76
|
-
--modal-backend=local # subprocesses instead of sandboxes
|
|
77
|
-
```
|
|
78
|
-
|
|
79
66
|
## Implementation
|
|
80
67
|
|
|
81
68
|
1. `pytest` becomes Modal controller - lists tests and shards accordingly
|
|
@@ -89,9 +76,9 @@ Some more flags below:
|
|
|
89
76
|
|
|
90
77
|
### Caching
|
|
91
78
|
|
|
92
|
-
- **Outside Modal (
|
|
93
|
-
- **Inside a Modal sandbox (
|
|
94
|
-
- **Explicit ID (
|
|
79
|
+
- **Outside Modal (**`upload`**, default on laptops/CI):** builds/reuses a `debian_slim` image matching your local Python minor version and packages, then uploads the repo on top. Override with `pytest_modal_image`.
|
|
80
|
+
- **Inside a Modal sandbox (**`disk`**):** snapshots the current sandbox's filesystem (including build artifacts) and fans shards out from it.
|
|
81
|
+
- **Explicit ID (**`--modal-from=sb-...` **or** `im-...`**):** snapshots that sandbox or boots from that image directly; `--modal-workdir` sets the working directory.
|
|
95
82
|
|
|
96
83
|
### Weighting
|
|
97
84
|
|
|
@@ -108,13 +95,13 @@ Some more flags below:
|
|
|
108
95
|
|
|
109
96
|
- Locally, `modal setup` is enough.
|
|
110
97
|
- In CI, set `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET`, and `MODAL_ENVIRONMENT` using a [service user](https://modal.com/docs/guide/service-users) with the Contributor role on a dedicated environment.
|
|
111
|
-
-
|
|
98
|
+
- `MODAL_*` env vars are alway scrubbed from shards.
|
|
112
99
|
|
|
113
100
|
## Configuration
|
|
114
101
|
|
|
115
102
|
### CLI flags
|
|
116
103
|
|
|
117
|
-
|
|
|
104
|
+
| Command‑line flag name | Default | What it does |
|
|
118
105
|
| --- | --- | --- |
|
|
119
106
|
| `--modal` | off | Run tests sharded across Modal sandboxes. |
|
|
120
107
|
| `--modal-shards` | `auto` | Exact number of shards (`N`), or `auto` to size from past test timings. Explicit `N` is not capped by `--modal-max-shards`. |
|
|
@@ -139,8 +126,7 @@ Some more flags below:
|
|
|
139
126
|
| `modal_timeout` | `3600` | Max lifetime in seconds for each sandbox (and disk snapshot TTL). |
|
|
140
127
|
| `modal_start_timeout` | `300` | Max seconds a shard may take to start before it is replaced. |
|
|
141
128
|
|
|
142
|
-
Hooks go in `modal_conf.py` next to the pytest configuration
|
|
143
|
-
import `modal`:
|
|
129
|
+
Hooks go in `modal_conf.py` next to the pytest configuration, or wherever you specify.
|
|
144
130
|
|
|
145
131
|
```python
|
|
146
132
|
import modal
|
|
@@ -154,7 +140,7 @@ def pytest_modal_sandbox(config): # keyword arguments for modal.Sandbox.create
|
|
|
154
140
|
return {"cpu": (0.125, 8), "gpu": "T4"}
|
|
155
141
|
```
|
|
156
142
|
|
|
157
|
-
##
|
|
143
|
+
## Shard semantics
|
|
158
144
|
|
|
159
145
|
- Session-scoped fixtures set up and tear down once per sandbox. Module-scoped fixtures run once per file
|
|
160
146
|
while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fixture where it is.
|
|
@@ -162,7 +148,7 @@ while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fi
|
|
|
162
148
|
`--cov-fail-under` use the combined result.
|
|
163
149
|
- A file skipped as a whole and warnings raised in a sandbox are reported once, as in a plain run.
|
|
164
150
|
|
|
165
|
-
##
|
|
151
|
+
## Troubleshooting
|
|
166
152
|
|
|
167
153
|
| Event | Result |
|
|
168
154
|
| --- | --- |
|
|
@@ -179,56 +165,14 @@ while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fi
|
|
|
179
165
|
|
|
180
166
|
## Measured
|
|
181
167
|
|
|
182
|
-
|
|
168
|
+
| Suite | Sharding | Plain pytest | pytest-modal |
|
|
169
|
+
| --- | --- | ---: | ---: |
|
|
170
|
+
| [mpmath](https://github.com/mpmath/mpmath) | Upload, by file (9 shards, cached timings) | 560 s | 156 s |
|
|
171
|
+
| mpmath | Upload, by test (42 shards) | 560 s | 40 s |
|
|
172
|
+
| mpmath | Disk snapshot, by test (28 shards) | 576 s | 61 s |
|
|
173
|
+
| pybind11 | Disk snapshot of a warm build, default shard count | 14–129 s | 5–19 s |
|
|
183
174
|
|
|
184
|
-
|
|
185
|
-
| --- | --- |
|
|
186
|
-
| 5 (one per file), image not yet built | 14.3 s |
|
|
187
|
-
| 5 (one per file) | 7.8 s |
|
|
188
|
-
| 25 (`--modal-group-by=test`) | 4.7 s |
|
|
189
|
-
|
|
190
|
-
[mpmath](https://github.com/mpmath/mpmath)'s suite (2,765 tests with its doctests; pure Python; needs
|
|
191
|
-
hypothesis, pexpect, ipython and pytest-timeout), with no configuration for this plugin. Plain pytest takes
|
|
192
|
-
560 s on the same cloud VM and 576 s in a sandbox. One run each:
|
|
193
|
-
|
|
194
|
-
| Where the shards get the project | Run | Shards | Wall |
|
|
195
|
-
| --- | --- | --- | --- |
|
|
196
|
-
| Upload | first: no weights, image built (11 s) | 4 | 210 s |
|
|
197
|
-
| Upload | later: kept weights | 9 | 156 s |
|
|
198
|
-
| Upload | `--modal-group-by=test` | 42 | 40 s |
|
|
199
|
-
| Disk, pytest inside a runner sandbox | first | 4 | 232 s |
|
|
200
|
-
| Disk | later | 8 | 192 s |
|
|
201
|
-
| Disk | `--modal-group-by=test` | 28 | 61 s |
|
|
202
|
-
| `--modal-from=<sandbox id>`, pytest outside it | `--modal-group-by=test` | 64 | 44 s |
|
|
203
|
-
|
|
204
|
-
In each row every test has the outcome it has in a plain run (the junit files compared test by test), also
|
|
205
|
-
with `--modal-collect=remote`, `--cov`, `-k`, `-x`, `--lf` and a failing test. With files kept whole the
|
|
206
|
-
run is as long as the suite's longest file, 136 s here, which is why `--modal-group-by=test` is four times
|
|
207
|
-
faster. Coverage came to the same 21,845 statements; 5 lines differed, all reached only by tests that draw
|
|
208
|
-
unseeded random numbers.
|
|
209
|
-
|
|
210
|
-
The same suite with `--modal-group-by=test` and the shard count given, up to a sandbox for each test. One
|
|
211
|
-
test of 44 s bounds every one of these runs (31 to 53 s), so the columns are what the count changes. Upload;
|
|
212
|
-
a disk snapshot gives much the same.
|
|
213
|
-
|
|
214
|
-
| Shards | A shard is up in (median) | The last one is up after | Controller CPU | Sandbox-seconds |
|
|
215
|
-
| --- | --- | --- | --- | --- |
|
|
216
|
-
| 64 | 1.3 s | 4.3 s | 2.9 s | 1,158 |
|
|
217
|
-
| 128 | 1.3 s | 2.7 s | 3.4 s | 1,424 |
|
|
218
|
-
| 256 | 1.4 s | 3.7 s | 4.7 s | 2,001 |
|
|
219
|
-
| 512 | 1.6 s | 5.2 s | 6.8 s | 2,603 |
|
|
220
|
-
| 1,024 | 1.8 s | 13.9 s | 12.0 s | 4,643 |
|
|
221
|
-
| 2,765 (one per test) | 2.0 s | 30.4 s | 30.8 s | 9,699 |
|
|
222
|
-
|
|
223
|
-
Every run reports what a plain run does, test by test, with no shard restarted and nothing refused by
|
|
224
|
-
Modal. The controller starts about 80 shards a second on one core, so past a few hundred the later ones
|
|
225
|
-
wait for their turn. A shard costs 3 to 5 s besides its tests, which is why sandbox-seconds grow with the
|
|
226
|
-
count. The controller keeps a thread and about 0.4 MB for each shard: 1.1 GB at 2,765.
|
|
227
|
-
|
|
228
|
-
pybind11's pytest suite (1,138 to 1,483 tests on each of six interpreters, C++ modules built in a runner
|
|
229
|
-
sandbox, shards from its disk, `--modal-collect=remote`, default shard count): every row reports the same
|
|
230
|
-
counts as a plain run. With a warm build the six rows finish in 15 to 21 s; a row's pytest step takes 5 to
|
|
231
|
-
19 s where a plain run takes 14 to 129 s.
|
|
175
|
+
All 2,765 mpmath tests matched their plain pytest outcomes. The pybind11 times are per interpreter, and test counts matched on all six.
|
|
232
176
|
|
|
233
177
|
## Development
|
|
234
178
|
|
|
@@ -242,16 +186,9 @@ profile's token to the one `pytest` command inside their runner sandbox.
|
|
|
242
186
|
|
|
243
187
|
## Not done
|
|
244
188
|
|
|
245
|
-
-
|
|
246
|
-
|
|
247
|
-
-
|
|
248
|
-
|
|
249
|
-
-
|
|
250
|
-
|
|
251
|
-
up to `--modal-max-shards`. Later runs plan from what the tests took.
|
|
252
|
-
- A shard collects the whole of each file it has a test from.
|
|
253
|
-
- With `--modal-from=ID` the controller has none of the project, so `--cov` reports need the sources at the
|
|
254
|
-
same paths where it runs, and options a plugin of the project defines go through `--modal-args`.
|
|
255
|
-
- The default image cannot mirror what an index does not have for Linux; such environments need the
|
|
256
|
-
`pytest_modal_image` hook.
|
|
257
|
-
- The controller is tested on Linux and on macOS (arm64), not on Windows; sandboxes are Linux.
|
|
189
|
+
- `-s` shows output when each test finishes. Interactive debugging (`--pdb`, `--trace`) is unsupported, although there's nothing stopping you from inspecting a sandbox on Modal's dashboard.
|
|
190
|
+
- The controller starts about 80 shards per second at maximum...! Probably just needs to scale up.
|
|
191
|
+
- Without timing history, auto sharding uses test counts. Grouping by test can hit `--modal-max-shards` on the first run.
|
|
192
|
+
- With `--modal-from=ID`, coverage needs source files at matching paths on the controller. Pass project-specific flags via `--modal-args`.
|
|
193
|
+
- Dependencies unavailable on Linux package indexes need a custom `pytest_modal_image`.
|
|
194
|
+
- Sandboxes run Linux. The controller is tested on Linux and macOS (arm64).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# pytest-modal
|
|
2
2
|
|
|
3
3
|
Run a pytest session's tests across [Modal](https://modal.com) sandboxes with `--modal`. Useful for CI and remote-exec workflows I reckon.
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
Currently in alpha!
|
|
6
6
|
|
|
7
7
|
## Quickstart
|
|
@@ -35,19 +35,6 @@ modal: test_b.py took 5.0s of the 7.1s; --modal-group-by=test would split its te
|
|
|
35
35
|
============================= 20 passed in 13.03s ==============================
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
`pytest --modal --modal-backend=local` shards over local subprocesses
|
|
39
|
-
instead (skips Modal account requirement).
|
|
40
|
-
|
|
41
|
-
Some more flags below:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
--modal-shards=8 # exact shard count
|
|
45
|
-
--modal-max-shards=8 # cap auto concurrency
|
|
46
|
-
--modal-group-by=test # split inside files too
|
|
47
|
-
--modal-collect=local|remote # discover tests locally or in a sandbox
|
|
48
|
-
--modal-backend=local # subprocesses instead of sandboxes
|
|
49
|
-
```
|
|
50
|
-
|
|
51
38
|
## Implementation
|
|
52
39
|
|
|
53
40
|
1. `pytest` becomes Modal controller - lists tests and shards accordingly
|
|
@@ -61,9 +48,9 @@ Some more flags below:
|
|
|
61
48
|
|
|
62
49
|
### Caching
|
|
63
50
|
|
|
64
|
-
- **Outside Modal (
|
|
65
|
-
- **Inside a Modal sandbox (
|
|
66
|
-
- **Explicit ID (
|
|
51
|
+
- **Outside Modal (**`upload`**, default on laptops/CI):** builds/reuses a `debian_slim` image matching your local Python minor version and packages, then uploads the repo on top. Override with `pytest_modal_image`.
|
|
52
|
+
- **Inside a Modal sandbox (**`disk`**):** snapshots the current sandbox's filesystem (including build artifacts) and fans shards out from it.
|
|
53
|
+
- **Explicit ID (**`--modal-from=sb-...` **or** `im-...`**):** snapshots that sandbox or boots from that image directly; `--modal-workdir` sets the working directory.
|
|
67
54
|
|
|
68
55
|
### Weighting
|
|
69
56
|
|
|
@@ -80,13 +67,13 @@ Some more flags below:
|
|
|
80
67
|
|
|
81
68
|
- Locally, `modal setup` is enough.
|
|
82
69
|
- In CI, set `MODAL_TOKEN_ID`, `MODAL_TOKEN_SECRET`, and `MODAL_ENVIRONMENT` using a [service user](https://modal.com/docs/guide/service-users) with the Contributor role on a dedicated environment.
|
|
83
|
-
-
|
|
70
|
+
- `MODAL_*` env vars are alway scrubbed from shards.
|
|
84
71
|
|
|
85
72
|
## Configuration
|
|
86
73
|
|
|
87
74
|
### CLI flags
|
|
88
75
|
|
|
89
|
-
|
|
|
76
|
+
| Command‑line flag name | Default | What it does |
|
|
90
77
|
| --- | --- | --- |
|
|
91
78
|
| `--modal` | off | Run tests sharded across Modal sandboxes. |
|
|
92
79
|
| `--modal-shards` | `auto` | Exact number of shards (`N`), or `auto` to size from past test timings. Explicit `N` is not capped by `--modal-max-shards`. |
|
|
@@ -111,8 +98,7 @@ Some more flags below:
|
|
|
111
98
|
| `modal_timeout` | `3600` | Max lifetime in seconds for each sandbox (and disk snapshot TTL). |
|
|
112
99
|
| `modal_start_timeout` | `300` | Max seconds a shard may take to start before it is replaced. |
|
|
113
100
|
|
|
114
|
-
Hooks go in `modal_conf.py` next to the pytest configuration
|
|
115
|
-
import `modal`:
|
|
101
|
+
Hooks go in `modal_conf.py` next to the pytest configuration, or wherever you specify.
|
|
116
102
|
|
|
117
103
|
```python
|
|
118
104
|
import modal
|
|
@@ -126,7 +112,7 @@ def pytest_modal_sandbox(config): # keyword arguments for modal.Sandbox.create
|
|
|
126
112
|
return {"cpu": (0.125, 8), "gpu": "T4"}
|
|
127
113
|
```
|
|
128
114
|
|
|
129
|
-
##
|
|
115
|
+
## Shard semantics
|
|
130
116
|
|
|
131
117
|
- Session-scoped fixtures set up and tear down once per sandbox. Module-scoped fixtures run once per file
|
|
132
118
|
while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fixture where it is.
|
|
@@ -134,7 +120,7 @@ while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fi
|
|
|
134
120
|
`--cov-fail-under` use the combined result.
|
|
135
121
|
- A file skipped as a whole and warnings raised in a sandbox are reported once, as in a plain run.
|
|
136
122
|
|
|
137
|
-
##
|
|
123
|
+
## Troubleshooting
|
|
138
124
|
|
|
139
125
|
| Event | Result |
|
|
140
126
|
| --- | --- |
|
|
@@ -151,56 +137,14 @@ while files stay whole. `PYTEST_MODAL_SHARD` and `PYTEST_MODAL_SHARDS` tell a fi
|
|
|
151
137
|
|
|
152
138
|
## Measured
|
|
153
139
|
|
|
154
|
-
|
|
140
|
+
| Suite | Sharding | Plain pytest | pytest-modal |
|
|
141
|
+
| --- | --- | ---: | ---: |
|
|
142
|
+
| [mpmath](https://github.com/mpmath/mpmath) | Upload, by file (9 shards, cached timings) | 560 s | 156 s |
|
|
143
|
+
| mpmath | Upload, by test (42 shards) | 560 s | 40 s |
|
|
144
|
+
| mpmath | Disk snapshot, by test (28 shards) | 576 s | 61 s |
|
|
145
|
+
| pybind11 | Disk snapshot of a warm build, default shard count | 14–129 s | 5–19 s |
|
|
155
146
|
|
|
156
|
-
|
|
157
|
-
| --- | --- |
|
|
158
|
-
| 5 (one per file), image not yet built | 14.3 s |
|
|
159
|
-
| 5 (one per file) | 7.8 s |
|
|
160
|
-
| 25 (`--modal-group-by=test`) | 4.7 s |
|
|
161
|
-
|
|
162
|
-
[mpmath](https://github.com/mpmath/mpmath)'s suite (2,765 tests with its doctests; pure Python; needs
|
|
163
|
-
hypothesis, pexpect, ipython and pytest-timeout), with no configuration for this plugin. Plain pytest takes
|
|
164
|
-
560 s on the same cloud VM and 576 s in a sandbox. One run each:
|
|
165
|
-
|
|
166
|
-
| Where the shards get the project | Run | Shards | Wall |
|
|
167
|
-
| --- | --- | --- | --- |
|
|
168
|
-
| Upload | first: no weights, image built (11 s) | 4 | 210 s |
|
|
169
|
-
| Upload | later: kept weights | 9 | 156 s |
|
|
170
|
-
| Upload | `--modal-group-by=test` | 42 | 40 s |
|
|
171
|
-
| Disk, pytest inside a runner sandbox | first | 4 | 232 s |
|
|
172
|
-
| Disk | later | 8 | 192 s |
|
|
173
|
-
| Disk | `--modal-group-by=test` | 28 | 61 s |
|
|
174
|
-
| `--modal-from=<sandbox id>`, pytest outside it | `--modal-group-by=test` | 64 | 44 s |
|
|
175
|
-
|
|
176
|
-
In each row every test has the outcome it has in a plain run (the junit files compared test by test), also
|
|
177
|
-
with `--modal-collect=remote`, `--cov`, `-k`, `-x`, `--lf` and a failing test. With files kept whole the
|
|
178
|
-
run is as long as the suite's longest file, 136 s here, which is why `--modal-group-by=test` is four times
|
|
179
|
-
faster. Coverage came to the same 21,845 statements; 5 lines differed, all reached only by tests that draw
|
|
180
|
-
unseeded random numbers.
|
|
181
|
-
|
|
182
|
-
The same suite with `--modal-group-by=test` and the shard count given, up to a sandbox for each test. One
|
|
183
|
-
test of 44 s bounds every one of these runs (31 to 53 s), so the columns are what the count changes. Upload;
|
|
184
|
-
a disk snapshot gives much the same.
|
|
185
|
-
|
|
186
|
-
| Shards | A shard is up in (median) | The last one is up after | Controller CPU | Sandbox-seconds |
|
|
187
|
-
| --- | --- | --- | --- | --- |
|
|
188
|
-
| 64 | 1.3 s | 4.3 s | 2.9 s | 1,158 |
|
|
189
|
-
| 128 | 1.3 s | 2.7 s | 3.4 s | 1,424 |
|
|
190
|
-
| 256 | 1.4 s | 3.7 s | 4.7 s | 2,001 |
|
|
191
|
-
| 512 | 1.6 s | 5.2 s | 6.8 s | 2,603 |
|
|
192
|
-
| 1,024 | 1.8 s | 13.9 s | 12.0 s | 4,643 |
|
|
193
|
-
| 2,765 (one per test) | 2.0 s | 30.4 s | 30.8 s | 9,699 |
|
|
194
|
-
|
|
195
|
-
Every run reports what a plain run does, test by test, with no shard restarted and nothing refused by
|
|
196
|
-
Modal. The controller starts about 80 shards a second on one core, so past a few hundred the later ones
|
|
197
|
-
wait for their turn. A shard costs 3 to 5 s besides its tests, which is why sandbox-seconds grow with the
|
|
198
|
-
count. The controller keeps a thread and about 0.4 MB for each shard: 1.1 GB at 2,765.
|
|
199
|
-
|
|
200
|
-
pybind11's pytest suite (1,138 to 1,483 tests on each of six interpreters, C++ modules built in a runner
|
|
201
|
-
sandbox, shards from its disk, `--modal-collect=remote`, default shard count): every row reports the same
|
|
202
|
-
counts as a plain run. With a warm build the six rows finish in 15 to 21 s; a row's pytest step takes 5 to
|
|
203
|
-
19 s where a plain run takes 14 to 129 s.
|
|
147
|
+
All 2,765 mpmath tests matched their plain pytest outcomes. The pybind11 times are per interpreter, and test counts matched on all six.
|
|
204
148
|
|
|
205
149
|
## Development
|
|
206
150
|
|
|
@@ -214,16 +158,9 @@ profile's token to the one `pytest` command inside their runner sandbox.
|
|
|
214
158
|
|
|
215
159
|
## Not done
|
|
216
160
|
|
|
217
|
-
-
|
|
218
|
-
|
|
219
|
-
-
|
|
220
|
-
|
|
221
|
-
-
|
|
222
|
-
|
|
223
|
-
up to `--modal-max-shards`. Later runs plan from what the tests took.
|
|
224
|
-
- A shard collects the whole of each file it has a test from.
|
|
225
|
-
- With `--modal-from=ID` the controller has none of the project, so `--cov` reports need the sources at the
|
|
226
|
-
same paths where it runs, and options a plugin of the project defines go through `--modal-args`.
|
|
227
|
-
- The default image cannot mirror what an index does not have for Linux; such environments need the
|
|
228
|
-
`pytest_modal_image` hook.
|
|
229
|
-
- The controller is tested on Linux and on macOS (arm64), not on Windows; sandboxes are Linux.
|
|
161
|
+
- `-s` shows output when each test finishes. Interactive debugging (`--pdb`, `--trace`) is unsupported, although there's nothing stopping you from inspecting a sandbox on Modal's dashboard.
|
|
162
|
+
- The controller starts about 80 shards per second at maximum...! Probably just needs to scale up.
|
|
163
|
+
- Without timing history, auto sharding uses test counts. Grouping by test can hit `--modal-max-shards` on the first run.
|
|
164
|
+
- With `--modal-from=ID`, coverage needs source files at matching paths on the controller. Pass project-specific flags via `--modal-args`.
|
|
165
|
+
- Dependencies unavailable on Linux package indexes need a custom `pytest_modal_image`.
|
|
166
|
+
- Sandboxes run Linux. The controller is tested on Linux and macOS (arm64).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|