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
[RPC] Add option to make rref.get_type not block. #50977
Conversation
Per title. This allows it not to block Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 77db3d0 (more details on the Dr. CI page):
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
# or owner. | ||
future = Future() | ||
future.set_result(rref_type) | ||
return future |
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.
if this returns a future, do we need to annotate this function with an @rpc.functions.async_execution
decorator?
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 recall Future is not picklable, and we didn't plan to make Future picklable, as communicating a future to a remote process does not seem reasonable? E.g., if the future is not completed yet, do we need to update both local and remote futures when the local one is marked as completed?
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.
This won't return a future when called remotely, as the only remote call is from the below _rref_typeof_on_user
, and we call that with blocking (just need to get the type in that case).
I didn't decorate it with rpc.functions.async_execution for that reason, because its always ran synchronously when called over RPC. So I guess this means picklability of Future isn't a concern?
I think this could potentially cause issues later if this function is ran over RPC with blocking=False
, but since its private I'm assuming use cases will be like the ones below.
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.
Does it work if we always let the functions like getRRefType
and _rref_typeof_on_owner
return a future, and chain subsequent logic as a callback? It the Future is already completed when returning, subsequent logic will be run inline, which is the same as the current behavior. Otherwise, it's async.
} | ||
|
||
// Returns py::object that can Python type or future. |
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.
can -> can be
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
This should work, will add unittests. Edit: discussed offline that we will consider doing this in a follow up change. |
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
Codecov Report
@@ Coverage Diff @@
## gh/rohan-varma/219/base #50977 +/- ##
===========================================================
- Coverage 80.92% 80.91% -0.02%
===========================================================
Files 1948 1948
Lines 212255 212313 +58
===========================================================
+ Hits 171777 171787 +10
- Misses 40478 40526 +48 |
@mrshenli Do you mind taking another look at this one? Thanks! |
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [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! Shall we create an issue to track followup changes?
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
Adds a `blocking` flag that can be set to False to make this API return a `Future` to the type. This is to make this function non-blocking, mostly for a future change that will allow `rref.rpc_async()` to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line). Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/) [ghstack-poisoned]
This pull request has been merged in c3f2f32. |
Stack from ghstack:
Adds a
blocking
flag that can be set to False to make this API return aFuture
to the type. This is to make this function non-blocking, mostly for a future change that will allowrref.rpc_async()
to be completely non-blocking (it currently calls and waits for this function that issues an RPC in-line).Differential Revision: D25944582