Skip to content

[v3] StoreTests[RemoteStore] #1956

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

Closed
wants to merge 27 commits into from
Closed

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Jun 9, 2024

Attempts to specialize StoreTests with RemoteStore. Depends on #1785.

This is currently broken because I can't figure out the correct way to link up the s3 fixture with the StoreTests instance. Help would be appreciated!

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@d-v-b
Copy link
Contributor Author

d-v-b commented Jun 10, 2024

We are getting failures like this:

FAILED tests/v3/test_store/test_remote.py::TestRemoteStoreS3::test_get_partial_values[key_ranges3] - botocore.exceptions.HTTPClientError: An HTTP Client raised an unhandled exception: Task <Task pending name='Task-643293' coro=<_run_coros_in_chunks.<locals>._run_coro() running at /home/runner/.local/share/hatch/env/virtual/zarr/nOVTQ5-s/test.py3.11-1.24-optional/lib/python3.11/site-packages/fsspec/asyn.py:245> cb=[_wait.<locals>._on_completion() at /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/asyncio/tasks.py:519]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(17, handle=<Handle BaseS....0.1', 5555))>)()]> attached to a different loop

cc @martindurant in case you have any insights here. This builds off #1785, but since I'm touching a lot of code here, I spun it out into a separate PR (and I opened a corresponding PR against your branch, which you can ignore if you would rather look here).

@jhamman jhamman closed this Jun 11, 2024
@jhamman
Copy link
Member

jhamman commented Jun 11, 2024

Thanks @d-v-b for advancing this!

@joshmoore
Copy link
Member

joshmoore commented Aug 23, 2024

A heads up that I am likely in the throws of the same or at least similar issues here:

ome/ome2024-ngff-challenge#37

The mock tests failed but also a production run against a production but non-standard --endpoint-url is failing with:

botocore.exceptions.HTTPClientError: An HTTP Client raised an unhandled exception: Task <Task pending name='Task-13' coro=<_runner() running at /opt/homebrew/Caskroom/mambaforge/base/envs/challenge4/lib/python3.12/site-packages/zarr/sync.py:51> cb=[_chain_future.<locals>._call_set_state() at /opt/homebrew/Caskroom/mambaforge/base/envs/challenge4/lib/python3.12/asyncio/futures.py:394]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(10, handle=<Handle BaseS...96.70', 443))>)()]> attached to a different loop

I'll read through @d-v-b's history and see if it's the same problem or not.

Edit: yes, from #1956 (comment) it's the same. So a production bug and not just a testing issue. Note: I'm using the sync API.

cc: @martindurant

@martindurant
Copy link
Member

If the s3fs instance is to be used in async mode (which is the case), then it must be created within a coroutine running on the same event loop and thread as when it will be called. You can assign the loop= kwargs and defer creation of the session object, but it's better to follow the above rule.

but non-standard --endpoint-url

This will make a new instance, which is probably the difference. fsspec will reuse instances having exactly the same set of init arguments unless otherwise directed.

@joshmoore
Copy link
Member

Thanks, @martindurant! That makes sense conceptually, but can you give me a pointer on how to do that reliably for the new RemoteStore?

@martindurant
Copy link
Member

I suppose RemoteStore(...) must also be done in a coroutine and either pass asynchronous=True explicitly or ensure that no other s3fs instance was created beforehand. Although I helped make the class, it was far from clear to me how and when it was to be used...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants