Skip to content
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

Closed
wants to merge 9 commits into from

Conversation

rohan-varma
Copy link
Member

@rohan-varma rohan-varma commented Jan 23, 2021

Stack from ghstack:

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

Per title. This allows it not to block

Differential Revision: [D25944582](https://our.internmc.facebook.com/intern/diff/D25944582/)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jan 23, 2021

💊 CI failures summary and remediations

As of commit 77db3d0 (more details on the Dr. CI page):


  • 2/2 failures possibly* introduced in this PR
    • 2/2 non-CircleCI failure(s)

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
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@mrshenli mrshenli left a 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.
Copy link
Contributor

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]
@rohan-varma
Copy link
Member Author

rohan-varma commented Jan 26, 2021

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.

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
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #50977 (77db3d0) into gh/rohan-varma/219/base (1518aee) will decrease coverage by 0.01%.
The diff coverage is 23.75%.

@@                     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     

@rohan-varma
Copy link
Member Author

@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]
Copy link
Contributor

@mrshenli mrshenli left a 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]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in c3f2f32.

@facebook-github-bot facebook-github-bot deleted the gh/rohan-varma/219/head branch February 8, 2021 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged oncall: distributed Add this issue/PR to distributed oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants