-
Notifications
You must be signed in to change notification settings - Fork 77
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
uproot can not open files on dCache when 'https' protocol is used. #1255
Comments
On the other hand, this traditional script properly downloads files from dCache:
with the output:
|
I'm not sure if this is related, but i also noticed some issues when reading through dcache with the current default https method in uproot/fsspec. My main observation is that it hangs once i request columns (leading to the uproot source calling
Illustration of the second point in form of code (if you want to reproduce, replace url to something you have access to, the following probably needs a Belle II VO X509 certificate) import ssl
import os
from urllib.parse import urlparse
from http.client import HTTPSConnection
ctx = ssl.create_default_context(capath=os.environ["X509_CERT_DIR"])
ctx.load_cert_chain(os.environ["X509_USER_PROXY"])
path = "https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/belle/localgroupdisk/belle/user/nhart/test_202408141225/sub00/RootOutput_00000_job428876195_00.root"
parsed = urlparse(path)
conn = HTTPSConnection(parsed.hostname, port=parsed.port, context=ctx) Now conn.request("GET", f"{parsed.path}?{parsed.query}", headers={"Range": "bytes=0-10"})
resp = conn.getresponse()
print(resp.headers.as_string())
print(resp.status)
print(resp.read()) Gives something like
So, a redirect URL with some uuid in it. I can now open a connection to this and make multiple requests to it (but i can't use the URL parameters with the uuid in multiple connections) location = resp.headers["Location"]
parsed = urlparse(location)
conn = HTTPSConnection(parsed.hostname, port=parsed.port, context=ctx) # this is the new connection to the redirect location Now i can repeat the following many times, also with different ranges conn.request("GET", f"{parsed.path}?{parsed.query}", headers={"Range": "bytes=0-10"}) # the parsed.query now contains the url parameters needed
resp = conn.getresponse()
print(resp.headers.as_string())
print(resp.status)
print(resp.read()) Not sure what the solution is - one would need to introduce a corresponding behavior in the fsspec https source and/or make it use multi range requests again (what the old uproot HTTPSource did). Concerning the multi range requests what i get from @jpivarski's comments on older issues like #3 it was quite a struggle to even find out if a http server supports this. Or we stick to xrootd for storages like dcache? ... |
When I tried to open a file on dCache using 'https'+X509, uproot fails to open it. I am using:
This can be reproduced with :
The output of the above script looks like:
To access the files, one needs to pass X509 using SSLContext like above and might need to add the SSLContext like so:
The text was updated successfully, but these errors were encountered: