@@ -72,7 +72,11 @@ async def test_work_stealing(c, s, a, b):
72
72
assert len (b .data ) > 10
73
73
74
74
75
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 2 )
75
+ @gen_cluster (
76
+ client = True ,
77
+ nthreads = [("127.0.0.1" , 1 )] * 2 ,
78
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
79
+ )
76
80
async def test_dont_steal_expensive_data_fast_computation (c , s , a , b ):
77
81
np = pytest .importorskip ("numpy" )
78
82
@@ -91,7 +95,11 @@ async def test_dont_steal_expensive_data_fast_computation(c, s, a, b):
91
95
assert len (a .data ) == 12
92
96
93
97
94
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 2 )
98
+ @gen_cluster (
99
+ client = True ,
100
+ nthreads = [("127.0.0.1" , 1 )] * 2 ,
101
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
102
+ )
95
103
async def test_steal_cheap_data_slow_computation (c , s , a , b ):
96
104
x = c .submit (slowinc , 100 , delay = 0.1 ) # learn that slowinc is slow
97
105
await wait (x )
@@ -104,7 +112,11 @@ async def test_steal_cheap_data_slow_computation(c, s, a, b):
104
112
105
113
106
114
@pytest .mark .slow
107
- @gen_cluster (client = True , nthreads = [("" , 1 )] * 2 , config = NO_AMM )
115
+ @gen_cluster (
116
+ client = True ,
117
+ nthreads = [("" , 1 )] * 2 ,
118
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" , ** NO_AMM },
119
+ )
108
120
async def test_steal_expensive_data_slow_computation (c , s , a , b ):
109
121
np = pytest .importorskip ("numpy" )
110
122
@@ -121,7 +133,11 @@ async def test_steal_expensive_data_slow_computation(c, s, a, b):
121
133
assert b .data # not empty
122
134
123
135
124
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 10 , config = NO_AMM )
136
+ @gen_cluster (
137
+ client = True ,
138
+ nthreads = [("127.0.0.1" , 1 )] * 10 ,
139
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" , ** NO_AMM },
140
+ )
125
141
async def test_worksteal_many_thieves (c , s , * workers ):
126
142
x = c .submit (slowinc , - 1 , delay = 0.1 )
127
143
await x
@@ -283,7 +299,11 @@ async def test_eventually_steal_unknown_functions(c, s, a, b):
283
299
284
300
285
301
@pytest .mark .skip (reason = "" )
286
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 3 )
302
+ @gen_cluster (
303
+ client = True ,
304
+ nthreads = [("127.0.0.1" , 1 )] * 3 ,
305
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
306
+ )
287
307
async def test_steal_related_tasks (e , s , a , b , c ):
288
308
futures = e .map (
289
309
slowinc , range (20 ), delay = 0.05 , workers = a .address , allow_other_workers = True
@@ -299,7 +319,11 @@ async def test_steal_related_tasks(e, s, a, b, c):
299
319
assert nearby > 10
300
320
301
321
302
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 10 )
322
+ @gen_cluster (
323
+ client = True ,
324
+ nthreads = [("127.0.0.1" , 1 )] * 10 ,
325
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
326
+ )
303
327
async def test_dont_steal_fast_tasks_compute_time (c , s , * workers ):
304
328
def do_nothing (x , y = None ):
305
329
pass
@@ -315,7 +339,11 @@ def do_nothing(x, y=None):
315
339
assert len (s .workers [workers [0 ].address ].has_what ) == len (xs ) + len (futures )
316
340
317
341
318
- @gen_cluster (client = True , nthreads = [("" , 1 )])
342
+ @gen_cluster (
343
+ client = True ,
344
+ nthreads = [("" , 1 )],
345
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
346
+ )
319
347
async def test_dont_steal_fast_tasks_blocklist (c , s , a ):
320
348
async with BlockedGetData (s .address ) as b :
321
349
# create a dependency
@@ -358,7 +386,11 @@ def fast_blocked(i, x):
358
386
assert ts .who_has == {ws_a }
359
387
360
388
361
- @gen_cluster (client = True , nthreads = [("" , 1 )], config = NO_AMM )
389
+ @gen_cluster (
390
+ client = True ,
391
+ nthreads = [("" , 1 )],
392
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" , ** NO_AMM },
393
+ )
362
394
async def test_new_worker_steals (c , s , a ):
363
395
await wait (c .submit (slowinc , 1 , delay = 0.01 ))
364
396
@@ -380,7 +412,10 @@ async def test_new_worker_steals(c, s, a):
380
412
assert b .data
381
413
382
414
383
- @gen_cluster (client = True )
415
+ @gen_cluster (
416
+ client = True ,
417
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
418
+ )
384
419
async def test_work_steal_allow_other_workers (c , s , a , b ):
385
420
# Note: this test also verifies the baseline for all other tests below
386
421
futures = c .map (
@@ -397,7 +432,10 @@ async def test_work_steal_allow_other_workers(c, s, a, b):
397
432
assert result == sum (map (inc , range (100 )))
398
433
399
434
400
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 ), ("127.0.0.1" , 2 )])
435
+ @gen_cluster (
436
+ client = True ,
437
+ nthreads = [("127.0.0.1" , 1 ), ("127.0.0.1" , 2 )],
438
+ )
401
439
async def test_dont_steal_worker_restrictions (c , s , a , b ):
402
440
futures = c .map (slowinc , range (100 ), delay = 0.05 , workers = a .address )
403
441
@@ -504,7 +542,11 @@ async def test_steal_resource_restrictions(c, s, a):
504
542
assert 20 < len (a .state .tasks ) < 80
505
543
506
544
507
- @gen_cluster (client = True , nthreads = [("" , 1 , {"resources" : {"A" : 2 , "C" : 1 }})])
545
+ @gen_cluster (
546
+ client = True ,
547
+ nthreads = [("" , 1 , {"resources" : {"A" : 2 , "C" : 1 }})],
548
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
549
+ )
508
550
async def test_steal_resource_restrictions_asym_diff (c , s , a ):
509
551
# See https://github.com/dask/distributed/issues/5565
510
552
future = c .submit (slowinc , 1 , delay = 0.1 , workers = a .address )
@@ -541,7 +583,11 @@ def slow(x):
541
583
assert max (durations ) / min (durations ) < 3
542
584
543
585
544
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 4 )] * 2 )
586
+ @gen_cluster (
587
+ client = True ,
588
+ nthreads = [("127.0.0.1" , 4 )] * 2 ,
589
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
590
+ )
545
591
async def test_dont_steal_executing_tasks (c , s , a , b ):
546
592
futures = c .map (
547
593
slowinc , range (4 ), delay = 0.1 , workers = a .address , allow_other_workers = True
@@ -797,7 +843,10 @@ async def test_restart(c, s, a, b):
797
843
assert not any (x for L in steal .stealable .values () for x in L )
798
844
799
845
800
- @gen_cluster (client = True )
846
+ @gen_cluster (
847
+ client = True ,
848
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
849
+ )
801
850
async def test_steal_twice (c , s , a , b ):
802
851
x = c .submit (inc , 1 , workers = a .address )
803
852
await wait (x )
@@ -841,7 +890,10 @@ async def test_steal_twice(c, s, a, b):
841
890
@gen_cluster (
842
891
client = True ,
843
892
nthreads = [("" , 1 )] * 3 ,
844
- config = {"distributed.worker.memory.pause" : False },
893
+ config = {
894
+ "distributed.worker.memory.pause" : False ,
895
+ "distributed.scheduler.work-stealing-interval" : "100ms" ,
896
+ },
845
897
)
846
898
async def test_paused_workers_must_not_steal (c , s , w1 , w2 , w3 ):
847
899
w2 .status = Status .paused
@@ -859,7 +911,10 @@ async def test_paused_workers_must_not_steal(c, s, w1, w2, w3):
859
911
assert w3 .data
860
912
861
913
862
- @gen_cluster (client = True )
914
+ @gen_cluster (
915
+ client = True ,
916
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
917
+ )
863
918
async def test_dont_steal_already_released (c , s , a , b ):
864
919
future = c .submit (slowinc , 1 , delay = 0.05 , workers = a .address )
865
920
key = future .key
@@ -886,7 +941,11 @@ async def test_dont_steal_already_released(c, s, a, b):
886
941
await asyncio .sleep (0.05 )
887
942
888
943
889
- @gen_cluster (client = True , nthreads = [("127.0.0.1" , 1 )] * 2 )
944
+ @gen_cluster (
945
+ client = True ,
946
+ nthreads = [("127.0.0.1" , 1 )] * 2 ,
947
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
948
+ )
890
949
async def test_dont_steal_long_running_tasks (c , s , a , b ):
891
950
def long (delay ):
892
951
with worker_client () as c :
@@ -974,7 +1033,7 @@ async def test_lose_task(c, s, a, b):
974
1033
assert "Error" not in out
975
1034
976
1035
977
- @pytest .mark .parametrize ("interval, expected" , [(None , 100 ), ("500ms" , 500 ), (2 , 2 )])
1036
+ @pytest .mark .parametrize ("interval, expected" , [(None , 1000 ), ("500ms" , 500 ), (2 , 2 )])
978
1037
@gen_cluster (nthreads = [], config = {"distributed.scheduler.work-stealing" : False })
979
1038
async def test_parse_stealing_interval (s , interval , expected ):
980
1039
from distributed .scheduler import WorkStealing
@@ -991,7 +1050,10 @@ async def test_parse_stealing_interval(s, interval, expected):
991
1050
assert s .periodic_callbacks ["stealing" ].callback_time == expected
992
1051
993
1052
994
- @gen_cluster (client = True )
1053
+ @gen_cluster (
1054
+ client = True ,
1055
+ config = {"distributed.scheduler.work-stealing-interval" : "100ms" },
1056
+ )
995
1057
async def test_balance_with_longer_task (c , s , a , b ):
996
1058
np = pytest .importorskip ("numpy" )
997
1059
0 commit comments