-
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ void GcsTaskManager::GcsTaskManagerStorage::MarkTaskAttemptFailedIfNeeded( | |
// We could mark the task as failed even if might not have state updates yet (i.e. only | ||
// profiling events are reported). | ||
auto state_updates = task_events.mutable_state_updates(); | ||
state_updates->set_failed_ts(failed_ts); | ||
(*state_updates->mutable_state_ts())[ray::rpc::TaskStatus::FAILED] = failed_ts; | ||
state_updates->mutable_error_info()->CopyFrom(error_info); | ||
} | ||
|
||
|
@@ -423,6 +423,28 @@ 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 commentThe reason will be displayed to describe this comment to others. Learn more. main change 2 |
||
const google::protobuf::EnumDescriptor *task_status_descriptor = | ||
ray::rpc::TaskStatus_descriptor(); | ||
|
||
// 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 commentThe 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 This probably could go in another PR. 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. 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 |
||
for (int i = task_status_descriptor->value_count() - 1; i >= 0; --i) { | ||
if (task_event.state_updates().state_ts().contains( | ||
task_status_descriptor->value(i)->number())) { | ||
state = static_cast<ray::rpc::TaskStatus>( | ||
task_status_descriptor->value(i)->number()); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (filters.state() != task_status_descriptor->FindValueByNumber(state)->name()) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,18 +220,6 @@ message TaskLogInfo { | |
message TaskStateUpdate { | ||
// Node that runs the task. | ||
optional bytes node_id = 1; | ||
// Timestamp when status changes to PENDING_ARGS_AVAIL. | ||
optional int64 pending_args_avail_ts = 2; | ||
// Timestamp when status changes to PENDING_NODE_ASSIGNMENT. | ||
optional int64 pending_node_assignment_ts = 3; | ||
// Timestamp when status changes to SUBMITTED_TO_WORKER. | ||
optional int64 submitted_to_worker_ts = 4; | ||
// Timestamp when status changes to RUNNING. | ||
optional int64 running_ts = 5; | ||
// Timestamp when status changes to FINISHED. | ||
optional int64 finished_ts = 6; | ||
// Timestamp when status changes to FAILED. | ||
optional int64 failed_ts = 7; | ||
// Worker that runs the task. | ||
optional bytes worker_id = 8; | ||
// Task faulure info. | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. main change 3 |
||
} | ||
|
||
// Represents events and state changes from a single task run. | ||
|
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