-
Notifications
You must be signed in to change notification settings - Fork 91
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
Thread-local Session Management and Cookie Reuse to Address EDL DSE issue #909
base: main
Are you sure you want to change the base?
Conversation
👈 Launch a binder notebook on this branch for commit 9930d84 I will automatically update this comment whenever this PR is modified |
Following my earlier note, |
Hi @hailiangzhang, I'm looking at the PR now. I think it would be useful to create an issue since it will be more visible to other users and this PR will be the fix to that. For integration tests, we need to export our EDL credentials and follow these instructions: https://earthaccess.readthedocs.io/en/latest/contributing/development/#running-tests let us know if they are clear otherwise we can work on improving them! I'm going to start some unit tests for this. I think this is a major change in the way the download methods will work so we better test them extensively. Thanks for working on this!! |
Thanks @luzpaz for your suggestions -- I just created an issue report here. Please let me know if it was not created under the right category. For the integration tests, the main issue is really coming from the laptop system setup I have. I can try to follow the instructions and will ping you if I have problems. Thanks! |
This pull request addresses a DSE issue reported by Earthdata Login (EDL) during data download requests involving large amount of granules through EarthAccess. One issue was traced to EarthAccess creating a new session for each download instead of reusing the existing session cookie, which is intended to reduce the number of requests to EDL by the DAAC data distribution endpoint (TEA). This PR introduces changes to enhance session cookie handling within each thread, avoiding EDL requests from TEA in subsequent authenticated data downloads.
Key modifications in this PR include:
_clone_session_in_local_thread
method to clone and store sessions in thread-local storage._download_file
method to utilize thread-local session cookies and reduce redundant session creation within each thread.get_requests_session
to retrieve an existing session or raise an error if none exists.Notes:
Pull Request (PR) draft checklist - click to expand
contributing documentation
before getting started.
title such as "Add testing details to the contributor section of the README".
Example PRs: #763
example
closes #1
. SeeGitHub docs - Linking a pull request to an issue.
CHANGELOG.md
with details about your change in a section titled## Unreleased
. If such a section does not exist, please create one. FollowCommon Changelog for your additions.
Example PRs: #763
README.md
with details of changes to theearthaccess interface, if any. Consider new environment variables, function names,
decorators, etc.
Click the "Ready for review" button at the bottom of the "Conversation" tab in GitHub
once these requirements are fulfilled. Don't worry if you see any test failures in
GitHub at this point!
Pull Request (PR) merge checklist - click to expand
Please do your best to complete these requirements! If you need help with any of these
requirements, you can ping the
@nsidc/earthaccess-support
team in a comment and wewill help you out!
Request containing "pre-commit.ci autofix" to automate this.
📚 Documentation preview 📚: https://earthaccess--909.org.readthedocs.build/en/909/