@@ -2325,6 +2325,51 @@ def transition_waiting_memory(
2325
2325
pdb .set_trace ()
2326
2326
raise
2327
2327
2328
+ def transition_queued_memory (
2329
+ self ,
2330
+ key : str ,
2331
+ stimulus_id : str ,
2332
+ * ,
2333
+ nbytes : int | None = None ,
2334
+ type : bytes | None = None ,
2335
+ typename : str | None = None ,
2336
+ worker : str ,
2337
+ ** kwargs : Any ,
2338
+ ):
2339
+ try :
2340
+ ws : WorkerState = self .workers [worker ]
2341
+ ts : TaskState = self .tasks [key ]
2342
+ recommendations : dict = {}
2343
+ client_msgs : dict = {}
2344
+ worker_msgs : dict = {}
2345
+
2346
+ if self .validate :
2347
+ assert not ts .processing_on
2348
+ assert ts .state == "queued"
2349
+
2350
+ if nbytes is not None :
2351
+ ts .set_nbytes (nbytes )
2352
+
2353
+ self .queued .remove (ts )
2354
+ self .check_idle_saturated (ws )
2355
+
2356
+ _add_to_memory (
2357
+ self , ts , ws , recommendations , client_msgs , type = type , typename = typename
2358
+ )
2359
+
2360
+ if self .validate :
2361
+ assert not ts .processing_on
2362
+ assert ts .who_has
2363
+
2364
+ return recommendations , client_msgs , worker_msgs
2365
+ except Exception as e :
2366
+ logger .exception (e )
2367
+ if LOG_PDB :
2368
+ import pdb
2369
+
2370
+ pdb .set_trace ()
2371
+ raise
2372
+
2328
2373
def transition_processing_memory (
2329
2374
self ,
2330
2375
key : str ,
@@ -2646,7 +2691,7 @@ def transition_processing_released(self, key: str, stimulus_id: str):
2646
2691
}
2647
2692
]
2648
2693
2649
- _propagage_released (self , ts , recommendations )
2694
+ _propagate_released (self , ts , recommendations )
2650
2695
return recommendations , {}, worker_msgs
2651
2696
except Exception as e :
2652
2697
logger .exception (e )
@@ -2870,7 +2915,7 @@ def transition_queued_released(self, key, stimulus_id):
2870
2915
2871
2916
self .queued .remove (ts )
2872
2917
2873
- _propagage_released (self , ts , recommendations )
2918
+ _propagate_released (self , ts , recommendations )
2874
2919
return recommendations , client_msgs , worker_msgs
2875
2920
except Exception as e :
2876
2921
logger .exception (e )
@@ -3016,6 +3061,7 @@ def transition_released_forgotten(self, key, stimulus_id):
3016
3061
("waiting" , "no-worker" ): transition_waiting_no_worker ,
3017
3062
("waiting" , "queued" ): transition_waiting_queued ,
3018
3063
("waiting" , "memory" ): transition_waiting_memory ,
3064
+ ("queued" , "memory" ): transition_queued_memory ,
3019
3065
("queued" , "released" ): transition_queued_released ,
3020
3066
("queued" , "processing" ): transition_queued_processing ,
3021
3067
("processing" , "released" ): transition_processing_released ,
@@ -7951,7 +7997,7 @@ def _add_to_memory(
7951
7997
)
7952
7998
7953
7999
7954
- def _propagage_released (
8000
+ def _propagate_released (
7955
8001
state : SchedulerState ,
7956
8002
ts : TaskState ,
7957
8003
recommendations : Recs ,
@@ -8305,10 +8351,9 @@ def heartbeat_interval(n: int) -> float:
8305
8351
8306
8352
8307
8353
def _task_slots_available (ws : WorkerState , saturation_factor : float ) -> int :
8308
- "Number of tasks that can be sent to this worker without oversaturating it"
8354
+ """ Number of tasks that can be sent to this worker without oversaturating it"" "
8309
8355
assert not math .isinf (saturation_factor )
8310
- nthreads = ws .nthreads
8311
- return max (math .ceil (saturation_factor * nthreads ), 1 ) - (
8356
+ return max (math .ceil (saturation_factor * ws .nthreads ), 1 ) - (
8312
8357
len (ws .processing ) - len (ws .long_running )
8313
8358
)
8314
8359
0 commit comments