Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ProxyObject.__del__ to use the new Disk IO API from #791 #802

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dask_cuda/proxy_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def __del__(self):
pxy.manager.remove(self)
if pxy.serializer == "disk":
header, _ = pxy.obj
os.remove(header["path"])
os.remove(header["disk-io-header"]["path"])

def _pxy_serialize(
self, serializers: Iterable[str], proxy_detail: ProxyDetail = None,
Expand Down
13 changes: 11 additions & 2 deletions dask_cuda/tests/test_proxify_host_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ def test_one_dev_item_limit():
assert is_proxies_equal(dhf.manager._host.get_proxies(), [k4])
assert is_proxies_equal(dhf.manager._dev.get_proxies(), [k1])

# Clean up
del k1, k4
dhf.clear()
assert len(dhf.manager) == 0

def test_one_item_host_limit():

def test_one_item_host_limit(capsys):
memory_limit = sizeof(asproxy(one_item_array(), serializers=("dask", "pickle")))
dhf = ProxifyHostFile(
device_memory_limit=one_item_nbytes, memory_limit=memory_limit
Expand Down Expand Up @@ -154,7 +159,6 @@ def test_one_item_host_limit():
assert is_proxies_equal(dhf.manager._disk.get_proxies(), [k1])
assert is_proxies_equal(dhf.manager._host.get_proxies(), [k2])
assert is_proxies_equal(dhf.manager._dev.get_proxies(), [k3])

dhf.manager.validate()

# Accessing k2 spills k3 and unspill k2
Expand All @@ -181,6 +185,11 @@ def test_one_item_host_limit():
assert is_proxies_equal(dhf.manager._host.get_proxies(), [k4])
assert is_proxies_equal(dhf.manager._dev.get_proxies(), [k1])

# Clean up
del k1, k2, k3, k4
dhf.clear()
assert len(dhf.manager) == 0


def test_spill_on_demand():
"""
Expand Down