@@ -1778,6 +1778,7 @@ def __init__(
17781778 self .task_groups = {}
17791779 self .task_prefixes = {}
17801780 self .task_metadata = {}
1781+ self .total_memory = 0
17811782 self .total_nthreads = 0
17821783 self .total_nthreads_history = [(time (), 0 )]
17831784 self .queued = queued
@@ -4087,7 +4088,7 @@ def identity(self, n_workers: int = -1) -> dict[str, Any]:
40874088 "started" : self .time_started ,
40884089 "n_workers" : len (self .workers ),
40894090 "total_threads" : self .total_nthreads ,
4090- "total_memory" : sum ( ws . memory_limit for ws in self .workers . values ()) ,
4091+ "total_memory" : self .total_memory ,
40914092 "workers" : {
40924093 worker .address : worker .identity ()
40934094 for worker in itertools .islice (self .workers .values (), n_workers )
@@ -4541,6 +4542,7 @@ async def add_worker(
45414542 dh_addresses .add (address )
45424543 dh ["nthreads" ] += nthreads
45434544
4545+ self .total_memory += ws .memory_limit
45444546 self .total_nthreads += nthreads
45454547 self .total_nthreads_history .append ((time (), self .total_nthreads ))
45464548 self .aliases [name ] = address
@@ -5452,6 +5454,7 @@ async def remove_worker(
54525454 dh_addresses : set = dh ["addresses" ]
54535455 dh_addresses .remove (address )
54545456 dh ["nthreads" ] -= ws .nthreads
5457+ self .total_memory -= ws .memory_limit
54555458 self .total_nthreads -= ws .nthreads
54565459 self .total_nthreads_history .append ((time (), self .total_nthreads ))
54575460 if not dh_addresses :
0 commit comments