-
Notifications
You must be signed in to change notification settings - Fork 7k
[xray] Implements ray.wait #2162
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
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
0e18ca7
Use pubsub instead of timeout.
elibol fc2572c
Correct status message.
elibol 2e8af60
eric's feedback!
elibol b57a548
Changes from Stephanie's review.
elibol a128698
object directory changes for ray.wait.
elibol fa5c32d
Merge branch 'master' into om_pubsub
elibol 0ccf46b
Merge branch 'master' into om_pubsub
elibol b02de4f
Merge branch 'om_pubsub' into om_wait
elibol f9a9e16
wait without testing or timeout=0.
elibol 15b7f61
Handle remaining cases for wait.
elibol a22263b
linting
elibol 8ab41f0
added tests of om wait imp.
elibol 98bacfa
add local test.
elibol d518a89
Merge branch 'master' into om_wait
elibol 53f33e0
plasma imp.
elibol 8ef35f7
block worker as with pull.
elibol 6e10f9e
local scheduler implementation of wait.
elibol 9a95c65
with passing tests.
elibol aa12bd7
minor adjustments.
elibol 9e1602d
Merge branch 'master' into om_wait_local_scheduler
elibol 304b39c
handle return statuses.
elibol 5d63bb3
enable more tests.
elibol cf1fdb2
add test for existing num_returns semantics, and maintain existing nu…
elibol 531d024
move error handling to both code paths.
elibol d0d3ea4
implementing another round of feedback.
elibol 62ae832
Comment on OM tests.
elibol 67eef67
remove check for length zero list.
elibol 0796a17
remove elapsed.
elibol dd9f0db
Preserve input/output order.
elibol 9d4ed2b
debias local objects.
elibol 541b88c
Merge branch 'master' into om_wait_local_scheduler
elibol 58af739
use common helper function in object directory.
elibol d9ef29b
updated documentation
elibol fa1928b
linting.
elibol d41b1d0
handle return status.
elibol aeaab5b
simplify order preservation test + fix valgrind test error.
elibol 048f45f
update name of final Lookup callback.
elibol 0aa7525
Merge branch 'master' into om_wait_local_scheduler
elibol 833939f
linting
elibol 8e1947c
c++ style casting.
elibol 83d04dd
linting.
elibol 080282f
linting.
elibol a58f5c9
incorporate second round of feedback.
elibol c6d8ba5
correct python tests.
elibol 7d8d756
test comments.
elibol 6b6e2f3
incorporate reviews.
elibol 3a86c93
Fixes with regression tests.
elibol 1a99f25
update documentation.
elibol 00eafd7
reference to avoid copy.
elibol 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
|
|
||
| #include "common_protocol.h" | ||
| #include "format/local_scheduler_generated.h" | ||
| #include "ray/raylet/format/node_manager_generated.h" | ||
|
|
||
| #include "common/io.h" | ||
| #include "common/task.h" | ||
|
|
@@ -186,3 +187,41 @@ void local_scheduler_set_actor_frontier(LocalSchedulerConnection *conn, | |
| write_message(conn->conn, MessageType_SetActorFrontier, frontier.size(), | ||
| const_cast<uint8_t *>(frontier.data())); | ||
| } | ||
|
|
||
| std::pair<std::vector<ObjectID>, std::vector<ObjectID>> local_scheduler_wait( | ||
| LocalSchedulerConnection *conn, | ||
| const std::vector<ObjectID> &object_ids, | ||
| int num_returns, | ||
| int64_t timeout_milliseconds, | ||
| bool wait_local) { | ||
| // Write request. | ||
| flatbuffers::FlatBufferBuilder fbb; | ||
| auto message = ray::protocol::CreateWaitRequest( | ||
| fbb, to_flatbuf(fbb, object_ids), num_returns, timeout_milliseconds, | ||
| wait_local); | ||
| fbb.Finish(message); | ||
| write_message(conn->conn, ray::protocol::MessageType_WaitRequest, | ||
| fbb.GetSize(), fbb.GetBufferPointer()); | ||
| // Read result. | ||
| int64_t type; | ||
| int64_t reply_size; | ||
| uint8_t *reply; | ||
| read_message(conn->conn, &type, &reply_size, &reply); | ||
|
Collaborator
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. add RAY_CHECK(type == MessageType_WaitReply); |
||
| RAY_CHECK(type == ray::protocol::MessageType_WaitReply); | ||
| auto reply_message = flatbuffers::GetRoot<ray::protocol::WaitReply>(reply); | ||
| // Convert result. | ||
| std::pair<std::vector<ObjectID>, std::vector<ObjectID>> result; | ||
| auto found = reply_message->found(); | ||
| for (uint i = 0; i < found->size(); i++) { | ||
| ObjectID object_id = ObjectID::from_binary(found->Get(i)->str()); | ||
| result.first.push_back(object_id); | ||
| } | ||
| auto remaining = reply_message->remaining(); | ||
| for (uint i = 0; i < remaining->size(); i++) { | ||
| ObjectID object_id = ObjectID::from_binary(remaining->Get(i)->str()); | ||
| result.second.push_back(object_id); | ||
| } | ||
| /* Free the original message from the local scheduler. */ | ||
| free(reply); | ||
| return result; | ||
| } | ||
This file contains hidden or 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 hidden or 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
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 is a memory leak, right?
replyneeds to get freed somewhere (there is a malloc inread_message).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.
Added
freeat the end.