Add callback to with_exception_handling#32136
Conversation
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
|
assign set of reviewers |
|
Assigning reviewers. If you would like to opt out of this review, comment R: @tvalentyn for label python. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
| raise Exception(f'Failed to pass in correct element, received {el}') | ||
| f = open(tmp_path, "a") | ||
| logging.warning(tmp_path) | ||
| f.write(file_contents) |
There was a problem hiding this comment.
nit: you could use https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_called_with
https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_not_called in unit tests. up to you.
There was a problem hiding this comment.
I found this didn't work. I'm not totally sure why, but I think it is because of how the scoping of the function works as it is passed through Beam. Somehow, it seems like its referencing a copy of the variable, I'm guessing it gets copied by value somewhere along the way... Maybe related to us spinning up new threads to handle pieces of this logic?
Regardless, I'm inclined to leave it rather than digging in further since it is still effectively testing correctness at this point.
* Add callback to with_exception_handling * Format * Format * Implement feedback
Allows users to define a callback to execute only on failure. Step 1 of #32137 though this is also a standalone feature
See full design here - https://docs.google.com/document/d/19ves6iv-m_6DFmePJZqYpLm-bCooPu6wQ-Ti6kAl2Jo/edit
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.