Use `cpu_perf_headroom()` at remaining deadlines
Finish TODO #2 from PR #468: the last raw `cpu_scaling_factor()` call-sites still used the static-only check (blind to the sustained-load power-cap). Point them at the `cpu_perf_headroom()` SUPERSET — it calls `cpu_scaling_factor()` internally + the session-cached throttle probe, so it's always >= the old factor (never LESS headroom, so CI stays green). Migrated, - `test_spawning`: the `fail_after(1 * ...)` smoke deadline (#465-added). - `test_inter_peer_cancellation`: `this_fast` budget. - `test_docs_examples`: example-run `timeout`. - `test_resource_cache`: fan-out `timeout`. `test_cancellation` already used `cpu_perf_headroom()`; only its explanatory comments still name the static helper. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
parent
b6184ab74e
commit
2e605da264
|
|
@ -145,7 +145,7 @@ def test_example(
|
||||||
'This test does run just fine "in person" however..'
|
'This test does run just fine "in person" however..'
|
||||||
)
|
)
|
||||||
|
|
||||||
from .conftest import cpu_scaling_factor
|
from .conftest import cpu_perf_headroom
|
||||||
|
|
||||||
timeout: float = (
|
timeout: float = (
|
||||||
60
|
60
|
||||||
|
|
@ -153,8 +153,9 @@ def test_example(
|
||||||
else 16
|
else 16
|
||||||
)
|
)
|
||||||
|
|
||||||
# add latency headroom for CPU freq scaling (auto-cpufreq et al.)
|
# add latency headroom for CPU freq scaling/throttle
|
||||||
headroom: float = cpu_scaling_factor()
|
# (auto-cpufreq et al.)
|
||||||
|
headroom: float = cpu_perf_headroom()
|
||||||
if headroom != 1.:
|
if headroom != 1.:
|
||||||
timeout *= headroom
|
timeout *= headroom
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ from tractor._testing import (
|
||||||
expect_ctxc,
|
expect_ctxc,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .conftest import cpu_scaling_factor
|
from .conftest import cpu_perf_headroom
|
||||||
|
|
||||||
pytestmark = [
|
pytestmark = [
|
||||||
pytest.mark.skipon_spawn_backend(
|
pytest.mark.skipon_spawn_backend(
|
||||||
|
|
@ -1280,12 +1280,12 @@ def test_peer_spawns_and_cancels_service_subactor(
|
||||||
|
|
||||||
|
|
||||||
async def _main():
|
async def _main():
|
||||||
headroom: float = cpu_scaling_factor()
|
headroom: float = cpu_perf_headroom()
|
||||||
this_fast_on_linux: float = 3
|
this_fast_on_linux: float = 3
|
||||||
this_fast = this_fast_on_linux * headroom
|
this_fast = this_fast_on_linux * headroom
|
||||||
if headroom != 1.:
|
if headroom != 1.:
|
||||||
test_log.warning(
|
test_log.warning(
|
||||||
f'Adding latency headroom on linux bc CPU scaling,\n'
|
f'Adding latency headroom on linux bc CPU perf scaling/throttle,\n'
|
||||||
f'headroom: {headroom}\n'
|
f'headroom: {headroom}\n'
|
||||||
f'this_fast_on_linux: {this_fast_on_linux} -> {this_fast}\n'
|
f'this_fast_on_linux: {this_fast_on_linux} -> {this_fast}\n'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -213,12 +213,12 @@ def test_open_local_sub_to_stream(
|
||||||
N local tasks using `trionics.maybe_open_context()`.
|
N local tasks using `trionics.maybe_open_context()`.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
from .conftest import cpu_scaling_factor
|
from .conftest import cpu_perf_headroom
|
||||||
timeout: float = (
|
timeout: float = (
|
||||||
4
|
4
|
||||||
if not platform.system() == "Windows"
|
if not platform.system() == "Windows"
|
||||||
else 10
|
else 10
|
||||||
) * cpu_scaling_factor()
|
) * cpu_perf_headroom()
|
||||||
|
|
||||||
if debug_mode:
|
if debug_mode:
|
||||||
timeout = 999
|
timeout = 999
|
||||||
|
|
|
||||||
|
|
@ -153,9 +153,9 @@ async def test_most_beautiful_word(
|
||||||
# actor spawn + IPC round-trip is comfortably sub-second on a
|
# actor spawn + IPC round-trip is comfortably sub-second on a
|
||||||
# warm box, but slow/noisy CI runners (esp. macOS) blow a flat
|
# warm box, but slow/noisy CI runners (esp. macOS) blow a flat
|
||||||
# 1s deadline. Scale for CI/CPU-throttle headroom — `== 1s`
|
# 1s deadline. Scale for CI/CPU-throttle headroom — `== 1s`
|
||||||
# locally where `cpu_scaling_factor()` is `1.0`.
|
# locally where `cpu_perf_headroom()` is `1.0`.
|
||||||
from .conftest import cpu_scaling_factor
|
from .conftest import cpu_perf_headroom
|
||||||
with trio.fail_after(1 * cpu_scaling_factor()):
|
with trio.fail_after(1 * cpu_perf_headroom()):
|
||||||
async with tractor.open_nursery(
|
async with tractor.open_nursery(
|
||||||
debug_mode=debug_mode,
|
debug_mode=debug_mode,
|
||||||
) as an:
|
) as an:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue