Skip to content

[Feature][history server] support endpoint /v0/tasks/summarize with lineage #4389

@Future-Outlier

Description

@Future-Outlier

// TODO(Han-Ju Chen): This function has a bug - using JobID instead of actual lineage.
// Real lineage requires:
// 1. Add ParentTaskID field to Task struct (types/task.go)
// 2. Parse parent_task_id from Ray events (eventserver.go)
// 3. Build task tree structure based on ParentTaskID
// 4. Update rayjob example to generate nested tasks for testing
func summarizeTasksByLineage(tasks []eventtypes.Task) map[string]interface{} {
summary := make(map[string]map[string]int)
for _, task := range tasks {
// Use JobID as a simple lineage grouping for now
lineageKey := task.JobID
if lineageKey == "" {
lineageKey = "unknown"
}
if _, ok := summary[lineageKey]; !ok {
summary[lineageKey] = make(map[string]int)
}
state := string(task.State)
if state == "" {
state = "UNKNOWN"
}
summary[lineageKey][state]++
}
return map[string]interface{}{
"summary": summary,
"total": len(tasks),
}
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions