Skip to content

Commit

Permalink
Renamed mem_usage_sub => mem_usage_remove
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Sep 8, 2021
1 parent 5c4ca1a commit 4225364
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dask_cuda/proxify_host_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def mem_usage_add(self, proxy: ProxyObject) -> None:
"""Given a new proxy, update `self._mem_usage`"""

@abc.abstractmethod
def mem_usage_sub(self, proxy: ProxyObject) -> None:
def mem_usage_remove(self, proxy: ProxyObject) -> None:
"""Removal of proxy, update `self._mem_usage`"""

def add(self, proxy: ProxyObject) -> None:
Expand All @@ -54,9 +54,9 @@ def add(self, proxy: ProxyObject) -> None:
self.mem_usage_add(proxy)

def remove(self, proxy: ProxyObject) -> None:
"""Remove proxy from tracking, calls `self.mem_usage_sub`"""
"""Remove proxy from tracking, calls `self.mem_usage_remove`"""
del self._proxy_id_to_proxy[id(proxy)]
self.mem_usage_sub(proxy)
self.mem_usage_remove(proxy)
if len(self._proxy_id_to_proxy) == 0:
if self._mem_usage != 0:
warnings.warn(
Expand Down Expand Up @@ -88,7 +88,7 @@ class ProxiesOnHost(Proxies):
def mem_usage_add(self, proxy: ProxyObject):
self._mem_usage += sizeof(proxy)

def mem_usage_sub(self, proxy: ProxyObject):
def mem_usage_remove(self, proxy: ProxyObject):
self._mem_usage -= sizeof(proxy)


Expand Down Expand Up @@ -117,7 +117,7 @@ def mem_usage_add(self, proxy: ProxyObject):
self._mem_usage += sizeof(dev_mem)
ps.add(proxy_id)

def mem_usage_sub(self, proxy: ProxyObject):
def mem_usage_remove(self, proxy: ProxyObject):
proxy_id = id(proxy)
for dev_mem in self.proxy_id_to_dev_mems.pop(proxy_id):
self.dev_mem_to_proxy_ids[dev_mem].remove(proxy_id)
Expand Down

0 comments on commit 4225364

Please sign in to comment.