Repository navigation
Clean up parallel SFTP requests on cancellation - #846
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #846 +/- ##
===========================================
+ Coverage 99.85% 99.87% +0.02%
===========================================
Files 95 102 +7
Lines 27784 32750 +4966
Branches 2908 3141 +233
===========================================
+ Hits 27743 32709 +4966
Misses 38 38
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Thanks very much for the PR! I'm going to add one additional change suggested by Claude to properly clean up the iterator if something inside the loop body raises an exception. Right now, this cleanup only occurs if the iter itself is cancelled. |
Owner
|
Additional fix is now in commit f7056ae in "develop". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cancelling a parallel SFTP file read or write leaves its outstanding requests running. Closing the SSH connection afterwards can produce unretrieved
SFTPConnectionLosttask exceptions.Cancel and gather outstanding requests on every exit from the parallel I/O iterator. Keep completed tasks owned until their results are consumed, so closing the iterator between yielded blocks also retrieves the rest of the batch.
Fixes #845.
Validation: three new loopback cancellation regressions fail on current
developand pass with the fix; they coverread(),write(), andread_parallel()and reuse the same file and connection afterwards. The SFTP suite passes (599 tests, one skip; 377 subtests), and the full suite passes (1,764 tests, 51 skips; 4,249 subtests). All configured pre-commit checks pass on Python 3.12/Linux. Native macOS/Windows and optional unavailable cryptographic backends were not tested locally.This contribution is provided under the project's EPL-2.0 / GPL-2.0-or-later license terms. Please list the contributor as omrzk.