Skip to content

Commit d9bc3c6

Browse files
authored
Remove nbytes_in_memory (#4930)
This doesn't appear to be necessary
1 parent edc1238 commit d9bc3c6

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

distributed/scheduler.py

-19
Original file line numberDiff line numberDiff line change
@@ -872,11 +872,6 @@ def __repr__(self):
872872
+ ">"
873873
)
874874

875-
@property
876-
def nbytes_in_memory(self):
877-
tg: TaskGroup
878-
return sum([tg._nbytes_in_memory for tg in self._groups])
879-
880875
@property
881876
def nbytes_total(self):
882877
tg: TaskGroup
@@ -922,10 +917,6 @@ class TaskGroup:
922917
923918
The total number of bytes that this task group has produced
924919
925-
.. attribute:: nbytes_in_memory: int
926-
927-
The number of bytes currently stored by this TaskGroup
928-
929920
.. attribute:: duration: float
930921
931922
The total amount of time spent on all tasks in this TaskGroup
@@ -944,7 +935,6 @@ class TaskGroup:
944935
_states: dict
945936
_dependencies: set
946937
_nbytes_total: Py_ssize_t
947-
_nbytes_in_memory: Py_ssize_t
948938
_duration: double
949939
_types: set
950940
_start: double
@@ -958,7 +948,6 @@ def __init__(self, name: str):
958948
self._states["forgotten"] = 0
959949
self._dependencies = set()
960950
self._nbytes_total = 0
961-
self._nbytes_in_memory = 0
962951
self._duration = 0
963952
self._types = set()
964953
self._start = 0.0
@@ -985,10 +974,6 @@ def dependencies(self):
985974
def nbytes_total(self):
986975
return self._nbytes_total
987976

988-
@property
989-
def nbytes_in_memory(self):
990-
return self._nbytes_in_memory
991-
992977
@property
993978
def duration(self):
994979
return self._duration
@@ -1559,7 +1544,6 @@ def set_nbytes(self, nbytes: Py_ssize_t):
15591544
if old_nbytes >= 0:
15601545
diff -= old_nbytes
15611546
self._group._nbytes_total += diff
1562-
self._group._nbytes_in_memory += diff
15631547
ws: WorkerState
15641548
for ws in self._who_has:
15651549
ws._nbytes += diff
@@ -2646,7 +2630,6 @@ def transition_memory_released(self, key, safe: bint = False):
26462630
for ws in ts._who_has:
26472631
del ws._has_what[ts]
26482632
ws._nbytes -= ts_nbytes
2649-
ts._group._nbytes_in_memory -= ts_nbytes
26502633
worker_msgs[ws._address] = [worker_msg]
26512634

26522635
ts._who_has.clear()
@@ -7336,8 +7319,6 @@ def _propagate_forgotten(
73367319
ts._waiting_on.clear()
73377320

73387321
ts_nbytes: Py_ssize_t = ts.get_nbytes()
7339-
if ts._who_has:
7340-
ts._group._nbytes_in_memory -= ts_nbytes
73417322

73427323
ws: WorkerState
73437324
for ws in ts._who_has:

distributed/tests/test_scheduler.py

-5
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,6 @@ async def test_task_groups(c, s, a, b):
18951895
# these must be true since in this simple case there is a 1to1 mapping
18961896
# between prefix and group
18971897
assert tg.duration == tp.duration
1898-
assert tg.nbytes_in_memory == tp.nbytes_in_memory
18991898
assert tg.nbytes_total == tp.nbytes_total
19001899
# It should map down to individual tasks
19011900
assert tg.nbytes_total == sum(
@@ -1908,16 +1907,13 @@ async def test_task_groups(c, s, a, b):
19081907
if ts.group is tg and ts.state == "memory"
19091908
]
19101909
)
1911-
assert tg.nbytes_in_memory == in_memory_ts
1912-
19131910
tg = s.task_groups[y.name]
19141911
assert tg.states["memory"] == 5
19151912

19161913
assert s.task_groups[y.name].dependencies == {s.task_groups[x.name]}
19171914

19181915
await c.replicate(y)
19191916
# TODO: Are we supposed to track replicated memory here? See also Scheduler.add_keys
1920-
assert tg.nbytes_in_memory == y.nbytes
19211917
assert "array" in str(tg.types)
19221918
assert "array" in str(tp.types)
19231919

@@ -1926,7 +1922,6 @@ async def test_task_groups(c, s, a, b):
19261922
while s.tasks:
19271923
await asyncio.sleep(0.01)
19281924

1929-
assert tg.nbytes_in_memory == 0
19301925
assert tg.states["forgotten"] == 5
19311926
# Ensure TaskGroup is removed once all tasks are in forgotten state
19321927
assert tg.name not in s.task_groups

0 commit comments

Comments
 (0)