File tree Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Expand file tree Collapse file tree 3 files changed +27
-11
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,13 @@ properties:
118
118
How frequently to balance worker loads
119
119
120
120
worker-saturation :
121
- type : number
122
- exclusiveMinimum : 0
121
+ oneOf :
122
+ - type : number
123
+ exclusiveMinimum : 0
124
+ # String "inf", not to be confused with .inf which in YAML means float
125
+ # infinity. This is necessary because there's no way to parse a float
126
+ # infinity from a DASK_* environment variable.
127
+ - enum : [inf]
123
128
description : |
124
129
Controls how many root tasks are sent to workers (like a `readahead`).
125
130
Original file line number Diff line number Diff line change @@ -1646,13 +1646,22 @@ def __init__(
1646
1646
/ 2.0
1647
1647
)
1648
1648
1649
- sat = dask .config .get ("distributed.scheduler.worker-saturation" )
1650
- try :
1651
- self .WORKER_SATURATION = float (sat )
1652
- except ValueError :
1653
- raise ValueError (
1654
- f"Unsupported `distributed.scheduler.worker-saturation` value { sat !r} . Must be a float."
1649
+ self .WORKER_SATURATION = dask .config .get (
1650
+ "distributed.scheduler.worker-saturation"
1651
+ )
1652
+ if self .WORKER_SATURATION == "inf" :
1653
+ # Special case necessary because there's no way to parse a float infinity
1654
+ # from a DASK_* environment variable
1655
+ self .WORKER_SATURATION = math .inf
1656
+ if (
1657
+ not isinstance (self .WORKER_SATURATION , (int , float ))
1658
+ or self .WORKER_SATURATION <= 0
1659
+ ):
1660
+ raise ValueError ( # pragma: nocover
1661
+ "`distributed.scheduler.worker-saturation` must be a float > 0; got "
1662
+ + repr (self .WORKER_SATURATION )
1655
1663
)
1664
+
1656
1665
self .transition_counter = 0
1657
1666
self ._idle_transition_counter = 0
1658
1667
self .transition_counter_max = transition_counter_max
Original file line number Diff line number Diff line change @@ -505,12 +505,14 @@ def func(first, second):
505
505
"saturation_config, expected_task_counts" ,
506
506
[
507
507
(2.5 , (5 , 3 )),
508
- ("2.5" , (5 , 3 )),
509
508
(2.0 , (4 , 2 )),
510
509
(1.1 , (3 , 2 )),
511
510
(1.0 , (2 , 1 )),
512
- (- 1.0 , (1 , 1 )),
513
- (float ("inf" ), (6 , 4 ))
511
+ (0.1 , (1 , 1 )),
512
+ # This is necessary because there's no way to parse a float infinite from
513
+ # a DASK_* environment variable
514
+ ("inf" , (6 , 4 )),
515
+ (float ("inf" ), (6 , 4 )),
514
516
# ^ depends on root task assignment logic; ok if changes, just needs to add up to 10
515
517
],
516
518
)
You can’t perform that action at this time.
0 commit comments