Commit 99046ec
committed
Mock out idle sleeps in orchestration tests (~9x faster)
The ax/orchestration test suite spent ~400s of wall time almost entirely
sleeping, not computing. Two sources of pure idle time are removed via a
shared _mock_orchestrator_poll_sleep() helper called from both test classes'
setUp:
1. The orchestrator polling loop (ax.orchestration.orchestrator.sleep). Many
tests leave init_seconds_between_polls / min_seconds_before_poll at their
non-zero defaults. Loop termination depends on total_seconds_elapsed (which
accumulates the configured interval regardless of actual sleeping), so
removing the wait is behavior-preserving.
2. The exponential backoff between DB-save retries in retry_on_exception
(initial_wait_seconds=5 -> 5s + 10s = 15s for test_suppress_all_storage_errors).
Only sleep is mocked, via a wraps-ed copy of the time module, so the retry
count and all other time.* functions are untouched and trial-TTL tests that
rely on real time.sleep still work.
Runtime: 401.6s -> 42.9s (single-threaded), all 164 tests still pass.1 parent b3ddd71 commit 99046ec
1 file changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
237 | 267 | | |
238 | 268 | | |
239 | 269 | | |
| |||
3120 | 3150 | | |
3121 | 3151 | | |
3122 | 3152 | | |
| 3153 | + | |
3123 | 3154 | | |
3124 | 3155 | | |
3125 | 3156 | | |
| |||
0 commit comments