-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Introduce thenAsync method on Future #57637
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
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 34adac2 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
| return childFut; | ||
| } | ||
|
|
||
| c10::intrusive_ptr<Future> thenAsync( |
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.
Looks like there is no usage of this API in this stack. Do we plan to use it in the near future?
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
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.
LGTM, assuming this will be tested in commits on top
aten/src/ATen/core/ivalue_inl.h
Outdated
| childFut->setError(std::current_exception()); | ||
| return; | ||
| } | ||
| intermediateFut->addCallback([childFut](Future& intermediateFut) { |
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.
move childFut?
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) [ghstack-poisoned]
Pull Request resolved: pytorch#57637 I had proposes a similar method in pytorch#48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. ghstack-source-id: 129567066 Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/)
|
This pull request has been merged in ce2f1c2. |
I had proposes a similar method in pytorch/pytorch#48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later. This new method is useful when one wants to use `then` but the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside. Differential Revision: [D28222809](https://our.internmc.facebook.com/intern/diff/D28222809/) ghstack-source-id: 128188695 Pull Request resolved: pytorch/pytorch#57637
Stack from ghstack:
I had proposes a similar method in #48790, although that PR was exposing it to Python and thus requires a bit more work. This PR only introduces this method as a C++ API. Python can be added later.
This new method is useful when one wants to use
thenbut the callback does perform some async operation itself, and one wants to "reconcile" the future produced inside the callback with the one produced outside.Differential Revision: D28222809