Commit d0cbf41
authored
test: fix canaries-v2 (#5932)
* fix: make JumpStart private hub integ tests xdist-safe
Under pytest-xdist (-n 120) each worker created its own private hub,
exhausting the per-account hub limit (100) and triggering destructive
cross-worker cleanup that deleted hubs other workers were actively
using, causing "Hub ... does not exist" failures. The add_model_references
fixture also swallowed all errors and did not wait for async reference
propagation, causing "Hub content ... does not exist" failures.
- Share a single hub across all xdist workers via filelock + a JSON
state file with reference counting; only the last worker tears it down.
- Make _cleanup_old_hubs non-destructive: only delete hubs older than
STALE_HUB_AGE_HOURS and never the active run's hub.
- Add add_model_references_to_hub helper that creates references
idempotently (keyed by hub + model set) and polls until each
reference is resolvable before tests run.
* fix: isolate sagemaker_session for serve integ tests to prevent settings pollution
ModelBuilder mutates session.settings._local_download_dir to a temporary
/tmp/sagemaker/model-builder/<uuid> path. The serve integ tests passed the
repo-wide session-scoped sagemaker_session fixture into ModelBuilder, so that
mutation leaked across test modules. After the temp dir was cleaned up, the
lingering setting broke unrelated tests sharing the same session, notably
tests/integ/sagemaker/workflow/test_tuning_steps.py::test_tuning_multi_algos
with "ValueError: Inputted directory ... does not exist".
Override sagemaker_session in tests/integ/sagemaker/serve/conftest.py with a
dedicated session (constructed identically to the parent fixture) so the
ModelBuilder mutation stays contained within the serve package.
* fix: tear down shared JumpStart hub after all xdist workers finish
The previous reference-counted teardown in the session fixture finalizer
was unsafe: pytest-xdist distributes tests dynamically, so a worker could
finish its session (running finalizers) while other workers still had hub
tests pending. Decrementing to zero there deleted the shared hub mid-run,
causing "Hub ... does not exist" / "Hub content ... does not exist"
failures in gated hub tests.
Workers now only create-or-reuse the shared hub (never delete it). Teardown
runs exactly once in pytest_sessionfinish on the controller process (no
workerinput), which is guaranteed to run after all workers finish. Stale
hub reclamation continues to be handled by the age-based _cleanup_old_hubs.
* fix: stabilize Spark jar build and inference-component endpoint timeout in integ tests
Two unrelated v2 integ-test failures, fixed together:
- test_spark_processing.py::test_sagemaker_pyspark_v3 (Spark 3.x): build_jar
ran javac/jar without checking exit codes, so a failed jar rebuild (which
truncates the committed hello-spark-java.jar) was swallowed and surfaced
later as a misleading "code ... wasn't found" error, especially under xdist
where the fixture runs per worker. Run the build commands with explicit
return-code checks and assert the jar exists afterward.
- test_serve_model_builder_inference_component_happy.py::
test_model_builder_ic_sagemaker_endpoint: deploying a 7B JumpStart model as
an inference component on ml.g5.24xlarge regularly needs more than the
15-minute standard endpoint timeout to reach InService (the failure was a
deploy timeout, not a quota cap). Add a dedicated 30-minute timeout
(SERVE_SAGEMAKER_IC_ENDPOINT_TIMEOUT) for this flow without changing the
standard serve endpoint timeout.
* https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logsV2:log-groups/log-group/$252Faws$252Fcodebuild$252Fsagemaker-python-sdk-ci-integ-tests/log-events/e558697a-488d-4eab-a4ad-2971d9a1081f
* fix: stop deleting shared JumpStart hub mid-run; xfail flaky IC deploy test
JumpStart hub:
The shared hub was being deleted at session end on the controller, but hub
tests deploy long-lived endpoints, so a straggler worker could still be running
a hub test at ~100% when teardown deleted the hub, causing intermittent
"Hub ... does not exist" failures (e.g. test_jumpstart_hub_gated_estimator_
with_eula). Stop deleting the hub during the run entirely: session-end teardown
still cleans leaked endpoints/models/configs/artifacts but no longer deletes the
hub, and stale hubs from prior runs are reclaimed proactively at setup via the
age-based _cleanup_old_hubs (older than STALE_HUB_AGE_HOURS).
Inference-component serve test:
test_model_builder_ic_sagemaker_endpoint fails in the ModelBuilder IC deploy
path: CreateEndpoint is followed by a DescribeEndpoint that intermittently
reports the endpoint as not found. This is an SDK-level issue, not a test
config problem, so xfail (non-strict) the test to unblock the canary while it
is tracked separately.
X-AI-Prompt: Stop mid-run hub deletion (rely on age-based reclamation) and xfail the flaky ModelBuilder inference-component deploy test
X-AI-Tool: kiro-cli
* test: speed up slow JumpStart estimator canary integ tests
These canaries only need to exercise the train/deploy/predict flow, not
produce a well-trained model, yet they dominated canary runtime (the
estimator tests each ran ~100 min). Trim the training workload to bring
the suite under one hour while keeping coverage intact.
Bert estimator tests (full QNLI -> QNLI-tiny + epochs=1):
- map the floating "*" version of huggingface-spc-bert-base-cased to the
QNLI-tiny dataset instead of the full QNLI dataset (constants.py)
- cap training to a single epoch (hyperparameters={"epochs": "1"}) for:
- test_jumpstart_estimator
- test_jumpstart_hub_estimator
- test_jumpstart_hub_estimator_with_session
Gated llama estimator tests (sec_amazon has no tiny variant, so cap steps
via hyperparameters={"max_steps": "1"}):
- test_gated_model_training_v1
- test_gated_model_training_v2
- test_jumpstart_hub_gated_estimator_with_eula
X-AI-Prompt: Reduce JumpStart estimator canary test runtime by using the tiny training dataset and capping epochs/steps so the suite finishes under an hour
X-AI-Tool: kiro-cli
* test: mark JumpStart neuron gated training test as slow_test
Excludes test_gated_model_training_v2_neuron from ci-integ-tests and
canaries-v2, which both filter out `slow_test`. Trn1/Inf2 capacity makes
this test prone to multi-hour stalls, and max_steps=1 cannot shrink the
provisioning wait.1 parent 07d5847 commit d0cbf41
11 files changed
Lines changed: 363 additions & 95 deletions
File tree
- tests/integ
- sagemaker
- jumpstart
- estimator
- model
- private_hub
- estimator
- model
- serve
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
43 | 54 | | |
44 | | - | |
45 | | - | |
| 55 | + | |
| 56 | + | |
46 | 57 | | |
47 | 58 | | |
48 | 59 | | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
55 | 69 | | |
56 | 70 | | |
57 | 71 | | |
| |||
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
76 | | - | |
| 90 | + | |
77 | 91 | | |
78 | 92 | | |
79 | 93 | | |
80 | 94 | | |
81 | | - | |
| 95 | + | |
82 | 96 | | |
83 | | - | |
| 97 | + | |
84 | 98 | | |
85 | 99 | | |
86 | 100 | | |
| |||
152 | 166 | | |
153 | 167 | | |
154 | 168 | | |
155 | | - | |
156 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
157 | 176 | | |
| 177 | + | |
| 178 | + | |
158 | 179 | | |
159 | | - | |
160 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
161 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
162 | 189 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
176 | 206 | | |
177 | | - | |
178 | 207 | | |
179 | | - | |
180 | | - | |
| 208 | + | |
| 209 | + | |
181 | 210 | | |
182 | | - | |
| 211 | + | |
183 | 212 | | |
184 | 213 | | |
185 | 214 | | |
| |||
210 | 239 | | |
211 | 240 | | |
212 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
213 | 263 | | |
214 | 264 | | |
215 | | - | |
216 | | - | |
217 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
| |||
190 | 199 | | |
191 | 200 | | |
192 | 201 | | |
| 202 | + | |
193 | 203 | | |
194 | 204 | | |
195 | 205 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
| |||
Lines changed: 14 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | | - | |
34 | 31 | | |
| 32 | + | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 44 | | |
55 | 45 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
59 | 50 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 51 | | |
64 | 52 | | |
65 | 53 | | |
| |||
70 | 58 | | |
71 | 59 | | |
72 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
73 | 64 | | |
74 | 65 | | |
75 | 66 | | |
| |||
110 | 101 | | |
111 | 102 | | |
112 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
113 | 107 | | |
114 | 108 | | |
115 | 109 | | |
| |||
149 | 143 | | |
150 | 144 | | |
151 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
152 | 149 | | |
153 | 150 | | |
154 | 151 | | |
| |||
0 commit comments