@@ -202,7 +202,11 @@ def _list_processing_tasks(
202202 for task_key , task_state in dask_scheduler .tasks .items ():
203203 if task_state .processing_on :
204204 worker_to_processing_tasks [task_state .processing_on .address ].append (
205- (task_key , task_state .resource_restrictions or {})
205+ (
206+ task_key ,
207+ (task_state .resource_restrictions or {})
208+ | {DASK_WORKER_THREAD_RESOURCE_NAME : 1 },
209+ )
206210 )
207211 return worker_to_processing_tasks
208212
@@ -270,19 +274,6 @@ async def get_worker_used_resources(
270274 DaskNoWorkersError
271275 """
272276
273- def _list_processing_tasks_on_worker (
274- dask_scheduler : distributed .Scheduler , * , worker_url : str
275- ) -> list [tuple [dask .typing .Key , DaskTaskResources ]]:
276- processing_tasks = []
277- for task_key , task_state in dask_scheduler .tasks .items ():
278- if task_state .processing_on and (
279- task_state .processing_on .address == worker_url
280- ):
281- processing_tasks .append (
282- (task_key , task_state .resource_restrictions or {})
283- )
284- return processing_tasks
285-
286277 async with _scheduler_client (scheduler_url , authentication ) as client :
287278 worker_url , _ = _dask_worker_from_ec2_instance (client , ec2_instance )
288279 worker_to_tasks = await _list_cluster_processing_tasks (client )
0 commit comments