-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Core] ray list tasks filter state and name on gcs side #46270
Conversation
Signed-off-by: Jiajun Yao <jeromeyjj@gmail.com>
elif key == "name": | ||
req_filters.name = value | ||
elif key == "state": | ||
req_filters.state = value |
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.
Main change 1
@@ -423,6 +423,27 @@ void GcsTaskManager::HandleGetTaskEvents(rpc::GetTaskEventsRequest request, | |||
return false; | |||
} | |||
|
|||
if (filters.has_state()) { |
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.
main change 2
@@ -244,6 +232,9 @@ message TaskStateUpdate { | |||
optional int32 worker_pid = 12; | |||
// Is task paused by debugger. | |||
optional bool is_debugger_paused = 13; | |||
// Key is the integer value of TaskStatus enum (protobuf doesn't support Enum as key). | |||
// Value is the timestamp when status changes to the target status indicated by the key. | |||
map<int32, int64> state_ts = 14; |
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.
main change 3
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 pretty clean to me!
|
||
// Figure out the latest state of a task. | ||
ray::rpc::TaskStatus state = ray::rpc::TaskStatus::NIL; | ||
if (task_event.has_state_updates()) { |
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.
since we are also doing something similar at the client when aggregating later, i wonder if this would go out of sync with that routine.
I wonder if it makes sense to add a current_state
to the task event when returned (even when there's no state filter), so we don't need to do that at the client.
This probably could go in another PR.
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.
Yea, we could do that. But based on the current logic, it shouldn't go out of sync since we just iterate through TaskStatus and find the last state that has timestamp.
Having a current_state
or define the common function in cython is a good follow-up to do.
Why are these changes needed?
Push down the task state and name filtering to gcs
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.