Skip to content

Commit 8b903b3

Browse files
committed
[Heuristics] Fix failing unit tests due to margin constraint
1 parent b531ff0 commit 8b903b3

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

distributed/tests/test_steal.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,8 +1448,8 @@ def func(*args):
14481448
"cost, ntasks, expect_steal",
14491449
[
14501450
pytest.param(10, 10, False, id="not enough work to steal"),
1451-
pytest.param(10, 12, True, id="enough work to steal"),
1452-
pytest.param(20, 12, False, id="not enough work for increased cost"),
1451+
pytest.param(10, 17, True, id="enough work to steal"),
1452+
pytest.param(20, 17, False, id="not enough work for increased cost"),
14531453
],
14541454
)
14551455
def test_balance_expensive_tasks(cost, ntasks, expect_steal):
@@ -2013,7 +2013,11 @@ def block(i: int, in_event: Event, block_event: Event) -> int:
20132013
@gen_cluster(
20142014
client=True,
20152015
nthreads=[("127.0.0.1", 1)] * 2,
2016-
config={"distributed.scheduler.work-stealing-interval": "100ms", **NO_AMM},
2016+
config={
2017+
"distributed.scheduler.work-stealing-interval": "100ms",
2018+
"distributed.scheduler.default-task-durations": {"slowidentity": 0.01},
2019+
**NO_AMM
2020+
},
20172021
)
20182022
async def test_reject_count_margin_metric(c, s, a, b):
20192023
"""
@@ -2023,16 +2027,16 @@ async def test_reject_count_margin_metric(c, s, a, b):
20232027
steal = s.extensions["stealing"]
20242028
await steal.stop()
20252029

2026-
# Generate large data on worker A to ensure high network transfer cost
2027-
[x] = await c.scatter([b"0" * 50_000_000], workers=a.address)
2030+
# Generate large data on worker A to ensure high network transfer cost (~0.1s)
2031+
[x] = await c.scatter([b"0" * 10_000_000], workers=a.address)
20282032

2029-
# Create tasks on A to saturate it and trigger stealing evaluation
2033+
# Create 14 tasks on A to saturate it (0.01s each). occ_victim will be ~0.14s.
20302034
futures = [
20312035
c.submit(slowidentity, x, pure=False, delay=0.01, workers=a.address, allow_other_workers=True)
2032-
for _ in range(10)
2036+
for _ in range(14)
20332037
]
20342038

2035-
while len(a.state.tasks) < 10:
2039+
while len(a.state.tasks) < 14:
20362040
await asyncio.sleep(0.01)
20372041

20382042
# Balance will evaluate the cost. High comm_cost, low compute.

0 commit comments

Comments
 (0)