-
Notifications
You must be signed in to change notification settings - Fork 35
Added sink commitment following qgis-pull-request #59241 #333
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,12 @@ def processAlgorithm( | |
|
||
feedback.setProgress(int(100.0 / count * num)) | ||
|
||
sink.flushBuffer() | ||
if hasattr(sink, "finalize"): | ||
sink.finalize() | ||
Comment on lines
+256
to
+257
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there sinks that have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The finalize() method was added in the linked PR (Nov 12, 2024), so every version after that should have the finalize method (3.42, I think). |
||
else: | ||
del sink | ||
Comment on lines
+258
to
+259
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does the sink get deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some versions before the linked PR this was a workaround so that all data is really written down to file. This triggers the write process. Will be obsolete on newer versions. |
||
|
||
return {self.OUT: dest_id} | ||
|
||
@staticmethod | ||
|
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.
According to the linked PR, we should check the return value and notify the user.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think for whatever reason this should work, but doesn't work in all versions:
https://github.com/qgis/QGIS/pull/59241/files (so finalize was added)
https://github.com/qgis/QGIS/blob/master/src/core/processing/qgsprocessingutils.h#L811 - from 3.42 onwards this seems to be mandatory.