Skip to content

Commit 2e48bea

Browse files
committed
fix: apply pre-commit formatting fixes
1 parent 8b903b3 commit 2e48bea

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

distributed/stealing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def balance(self) -> None:
490490

491491
# Require at least 50% ROI on the network transfer cost to prevent thrashing
492492
margin = comm_cost_thief * 0.5
493-
493+
494494
would_steal_without_margin = (
495495
occ_thief + comm_cost_thief + compute
496496
<= occ_victim - (comm_cost_victim + compute) / 2
@@ -536,7 +536,11 @@ def balance(self) -> None:
536536
logger.debug(
537537
"Work-stealing margin heuristic rejected steal of task %s "
538538
"(thief=%s, victim=%s, level=%d, margin=%.4f)",
539-
ts.key, thief.address, victim.address, level, margin,
539+
ts.key,
540+
thief.address,
541+
victim.address,
542+
level,
543+
margin,
540544
)
541545
self.scheduler.check_idle_saturated(
542546
victim, occ=combined_occupancy(victim)

distributed/tests/test_steal.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ def block(i: int, in_event: Event, block_event: Event) -> int:
20162016
config={
20172017
"distributed.scheduler.work-stealing-interval": "100ms",
20182018
"distributed.scheduler.default-task-durations": {"slowidentity": 0.01},
2019-
**NO_AMM
2019+
**NO_AMM,
20202020
},
20212021
)
20222022
async def test_reject_count_margin_metric(c, s, a, b):
@@ -2029,13 +2029,20 @@ async def test_reject_count_margin_metric(c, s, a, b):
20292029

20302030
# Generate large data on worker A to ensure high network transfer cost (~0.1s)
20312031
[x] = await c.scatter([b"0" * 10_000_000], workers=a.address)
2032-
2032+
20332033
# Create 14 tasks on A to saturate it (0.01s each). occ_victim will be ~0.14s.
20342034
futures = [
2035-
c.submit(slowidentity, x, pure=False, delay=0.01, workers=a.address, allow_other_workers=True)
2035+
c.submit(
2036+
slowidentity,
2037+
x,
2038+
pure=False,
2039+
delay=0.01,
2040+
workers=a.address,
2041+
allow_other_workers=True,
2042+
)
20362043
for _ in range(14)
20372044
]
2038-
2045+
20392046
while len(a.state.tasks) < 14:
20402047
await asyncio.sleep(0.01)
20412048

@@ -2044,6 +2051,8 @@ async def test_reject_count_margin_metric(c, s, a, b):
20442051
steal.balance()
20452052

20462053
assert sum(steal.metrics["reject_count_margin_total"].values()) >= 1
2054+
2055+
20472056
@gen_cluster(
20482057
nthreads=[("", 1)],
20492058
client=True,

0 commit comments

Comments
 (0)