-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Zarr-Python 3 compatibility #11388
Zarr-Python 3 compatibility #11388
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 13 files ±0 13 suites ±0 3h 14m 49s ⏱️ + 8m 37s Results for commit c1c7f5a. ± Comparison against base commit 295c8de. This pull request removes 1 and adds 1 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
We have a few more things to fix in Zarr before merging this. I'll circle back once this is ready for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jhamman. Exciting stuff. Let me know if you need anything while working through the compatibility fixes
Co-authored-by: James Bourbeau <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to bump CI here as it looks like there's been some relevant changes over in zarr-developers/zarr-python#2186 and I'm curious to see what tests looks like here now
@jrbourbeau -- this is just about ready to go. Any idea what is going on with the upstream test build? |
… into fix/zarr-array-construction-2
Hmm looking now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, looks like it might be a mamba=2
-related issue. Let's see if #11409 fixes things.
Alright, @jhamman merging |
…sk into fix/zarr-array-construction-2
So close here. We're down to just one error:
@jrbourbeau - do you have thoughts on how to debug this? This is a part of the Dask test suite I don't quite understand. |
@martindurant - also pinging you here because I assume you have sorted something similar in the past w/ fsspec. Looking at the logs, I see 3-4 threads:
|
zarr.core.common.to_thread creates a hidden ThreadPoolExecutor and stuff gets assigned to run there. If you wanted to maintain this pool, you would have to create and close it in order not to be caught by dask's thread checker. It is used throughout LocalStore, by the way, which makes no sense. It is also used for offloading en/decoding, which makes more sense, as these can involve considerable CPU. However, dask already has a pool running, so I would tentatively suggest that dask should take care of parallelism, and zarr should have a mode in which it never makes new threads. There is even an argument that the ioloop should not be created in its thread since a (distributed) dask worker already has one in the main thread, but fsspec does this too. On a worker, you may well then have three asyncio loops running on different threads. |
Heads-up, @jrbourbeau has been reassigned to baby-duty for the next month. He's unlikely to be responsive here. Your best bet may be @fjetter and colleagues. |
Makes sense. I'm fairly confident that none of the threads here are from the
+1, I agree with this
I'm curious there are ways to detect this and utilize an existing thread (or loop) in a general way. Also, it just occurred to me that this test may also raise an error with fsspec but it is probably not exercised through the distributed test suite today. I think I can rig that up pretty easily... Edit (5 minutes later): Indeed, using fsspec with zarr-python 2.18 also leaks threads: def test_zarr_distributed_roundtrip_fsspec(c):
pytest.importorskip("numpy")
da = pytest.importorskip("dask.array")
zarr = pytest.importorskip("zarr")
fsspec = pytest.importorskip("fsspec")
store = fsspec.get_mapper("s3://zarr-test")
a = da.zeros((3, 3), chunks=(1, 1))
a.to_zarr(store)
a2 = da.from_zarr(store)
da.assert_eq(a, a2, scheduler=c)
assert a2.chunks == a.chunks
My question: is this a problem we need to be concerned about? Dask+Fsspec+Zarr have been working fine for years with this extra thread. Only now, because Zarr has brought this thread/IO-loop into its core code path, have we caught it in Dask's test suite but its been around forever. |
A leaking thread is not a huge deal. For instance, we know that the offloading thread (I think Martin mentioned this earlier) is not cleaned up. We're initializing this on import time, see https://github.com/dask/distributed/blob/36020d6abe4506af08bae2807d78477b7916c8aa/distributed/utils_test.py#L112 such that the thread is already up and running before the test runs. So, if there is a way to initialize that hidden threadpool once before the tests run, that would be the cleanest solution |
@fjetter and co -- this is ready for a real review. The leaked thread issue was mostly fixed upstream, now Zarr includes a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, glad to see this got over the finish line. Thanks all
pre-commit run --all-files