-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Serve] Shared LongPollClient
for Router
s
#48807
Merged
Merged
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
5169e86
set up shared long poll client
JoshKarpel ae170d3
avoid mutating while iterating
JoshKarpel 53f97fc
better dictionary merge
JoshKarpel d586f08
protect against empty keys
JoshKarpel 6ce1b3e
Merge branch 'master' into shared-long-poll-client
JoshKarpel 9fa746b
call _count_send
JoshKarpel 83eb5cf
shorter sleep on empty keys
JoshKarpel cfc7d19
poll again if no callbacks
JoshKarpel c673bec
Merge branch 'master' into shared-long-poll-client
JoshKarpel 67384eb
Merge branch 'master' into shared-long-poll-client
JoshKarpel 1b4712f
Merge branch 'master' into shared-long-poll-client
JoshKarpel 62bb4c3
Merge branch 'master' into shared-long-poll-client
JoshKarpel 56b7df5
rework test
JoshKarpel 102fb09
use new handle
JoshKarpel ca4a1f7
does a long sleep fix it?
JoshKarpel 9737dbd
do not stop the dedicated client until the shared client gets an update
JoshKarpel 78d2b77
fix typo
JoshKarpel 9f14f71
tidy up
JoshKarpel a6676ed
Merge branch 'master' into shared-long-poll-client
JoshKarpel d7dd6de
undo test changes
JoshKarpel 4f93687
Merge branch 'master' into shared-long-poll-client
JoshKarpel 0c62830
Merge branch 'master' into shared-long-poll-client
JoshKarpel 49cc679
Merge branch 'master' into shared-long-poll-client
JoshKarpel 3dfce1f
Merge branch 'master' into shared-long-poll-client
JoshKarpel 0611dae
handle changes around update_running_targets
JoshKarpel d62e598
Merge branch 'master' into shared-long-poll-client
JoshKarpel dc5138c
Merge branch 'master' into shared-long-poll-client
JoshKarpel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -324,10 +324,16 @@ def make_nonblocking_calls(expected, expect_blocking=False): | |
make_nonblocking_calls({"2": 2}) | ||
|
||
|
||
def test_reconfigure_with_queries(serve_instance): | ||
def test_reconfigure_does_not_run_while_there_are_active_queries(serve_instance): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried to de-flake this test 🤞🏻 |
||
""" | ||
This tests checks that reconfigure can't trigger while there are active requests, | ||
so that the actor's state is not mutated mid-request. | ||
|
||
https://github.com/ray-project/ray/pull/20315 | ||
""" | ||
signal = SignalActor.remote() | ||
|
||
@serve.deployment(max_ongoing_requests=10, num_replicas=3) | ||
@serve.deployment(max_ongoing_requests=10, num_replicas=1) | ||
class A: | ||
def __init__(self): | ||
self.state = None | ||
|
@@ -340,17 +346,36 @@ async def __call__(self): | |
return self.state["a"] | ||
|
||
handle = serve.run(A.options(version="1", user_config={"a": 1}).bind()) | ||
responses = [handle.remote() for _ in range(30)] | ||
responses = [handle.remote() for _ in range(10)] | ||
|
||
# Give the queries time to get to the replicas before the reconfigure. | ||
time.sleep(0.1) | ||
|
||
@ray.remote(num_cpus=0) | ||
def reconfigure(): | ||
serve.run(A.options(version="1", user_config={"a": 2}).bind()) | ||
|
||
# Start the reconfigure; | ||
# this will not complete until the signal is released | ||
# to allow the queries to complete. | ||
reconfigure_ref = reconfigure.remote() | ||
|
||
# Release the signal to allow the queries to complete. | ||
signal.send.remote() | ||
|
||
# Wait for the reconfigure to complete. | ||
ray.get(reconfigure_ref) | ||
|
||
assert all([r.result() == 1 for r in responses]) | ||
# These should all be 1 because the queries were sent before the reconfigure, | ||
# the reconfigure blocks until they complete, | ||
# and we just waited for the reconfigure to finish. | ||
results = [r.result() for r in responses] | ||
print(results) | ||
assert all([r == 1 for r in results]) | ||
|
||
# If we query again, it should be 2, | ||
# because the reconfigure will have gone through after the | ||
# original queries completed. | ||
assert handle.remote().result() == 2 | ||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 case is now handled by https://github.com/ray-project/ray/pull/48807/files#diff-f138b21f7ddcd7d61c0b2704c8b828b9bbe7eb5021531e2c7fabeb20ec322e1aR280-R288 (and is necessary - when the shared client boots up for the first time it will send an RPC with no keys in it)