-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[DataPipe] adding a finally statement to ensure hook is reset #70214
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
Conversation
[ghstack-poisoned]
CI Flow Status⚛️ CI FlowRuleset - Version:
You can add a comment to the PR and tag @pytorchbot with the following commands: # ciflow rerun, "ciflow/default" will always be added automatically
@pytorchbot ciflow rerun
# ciflow rerun with additional labels "-l <ciflow/label_name>", which is equivalent to adding these labels manually and trigger the rerun
@pytorchbot ciflow rerun -l ciflow/scheduled -l ciflow/slow For more information, please take a look at the CI Flow Wiki. |
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 5e24a2d (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
# TODO(VitalyFedyunin): Better do it as `with` context for safety | ||
IterDataPipe.set_reduce_ex_hook(reduce_hook) | ||
if exclude_primitive: | ||
IterDataPipe.set_getstate_hook(getstate_hook) | ||
try: |
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.
@ejguan @VitalyFedyunin
I am under the impression that using try ... finally ...
here will provide more safety. The reduce
and getstate
hooks will be re-set to None
even if an exception is thrown.
Does that seem better? Or do we have to use a with
statement?
@NivekT has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…set" cc @VitalyFedyunin ejguan @NivekT Differential Revision: [D33255306](https://our.internmc.facebook.com/intern/diff/D33255306) [ghstack-poisoned]
@NivekT has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Stack from ghstack:
cc @VitalyFedyunin @ejguan @NivekT
Differential Revision: D33255306