-
Notifications
You must be signed in to change notification settings - Fork 3
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
_prepare_credentials: connector fix for fsspec>=2022.12 #28
Conversation
The above seems to work, but when running in debug mode ( import os
from dvc_http import HTTPFileSystem
os.environ["PYTHONASYNCIODEBUG"] = "1"
fs = HTTPFileSystem()
fs.get(
"https://wtfismyip.com/json", os.path.join(os.getcwd(), "wtfismyip.json")
) Traceback (most recent call last):
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/connector_testing.py", line 8, in <module>
fs = HTTPFileSystem()
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/.venv/lib/python3.10/site-packages/dvc_objects/fs/base.py", line 78, in __init__
self.fs_args.update(self._prepare_credentials(**kwargs))
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/dvc_http/__init__.py", line 83, in _prepare_credentials
client_kwargs["connector"] = aiohttp.TCPConnector(
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 771, in __init__
super().__init__(
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 267, in __init__
self._cleanup_closed()
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/.venv/lib/python3.10/site-packages/aiohttp/connector.py", line 405, in _cleanup_closed
self._cleanup_closed_handle = helpers.weakref_handle(
File "/Users/dtrifiro/work/dvc-plugins/dvc-http/.venv/lib/python3.10/site-packages/aiohttp/helpers.py", line 611, in weakref_handle
return loop.call_at(when, _weakref_handle, (weakref.ref(ob), name))
File "/usr/lib/python3.10/asyncio/base_events.py", line 734, in call_at
self._check_thread()
File "/usr/lib/python3.10/asyncio/base_events.py", line 792, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one I'll investigate a bit more before merging. |
Looks like the loop is closed before garbage collection. |
Okay that above error is a bug in fsspec's implementation or our config handling. aiohttp only tries to close connector if I have no idea why we set |
1041b90
to
4398016
Compare
@skshetry simplified the implementation a bit. Also took the occasion to test get rid some of the changes from iterative/dvc#7414:
|
I guess you meant |
4e81adb
to
dda1a84
Compare
@skshetry re-added |
simplify _prepare credentials, cleanup
dda1a84
to
38f42f5
Compare
# Force cleanup of closed SSL transports. | ||
# See https://github.com/iterative/dvc/issues/7414 | ||
enable_cleanup_closed=True, | ||
ssl=make_context(kwargs.get("ssl_verify")), |
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.
Looks like we should've pop()-ed ssl_verify here #40 Or not mixed client and connector kwargs at all.
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.
Oh, looks like it is already fixed upstream.
get_client