Skip to content

Commit

Permalink
fix: status UI fails to show task cells for workers
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Mitchell <[email protected]>
  • Loading branch information
starpit committed Aug 7, 2024
1 parent c6a5220 commit 6047a56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion pkg/be/kubernetes/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
return fmt.Errorf("Worker without component label %s\n", pod.Name)
}

runname, exists := pod.Labels["app.kubernetes.io/instance"]
if !exists {
return fmt.Errorf("Worker without instance/runname label %s\n", pod.Name)
}

name := pod.Name

if component == string(comp.WorkersComponent) {
Expand All @@ -78,7 +83,9 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp
return fmt.Errorf("Worker without pool name label %s\n", pod.Name)
}

// see watcher.sh remote=... TODO avoid these disparate hacks
poolname = strings.Replace(poolname, runname+"-", "", 1)

// see worker-watcher main.go getPodNameSuffix() TODO avoid these disparate hacks
lastDashIdx := strings.LastIndex(pod.Name, "-")
suffix := pod.Name[lastDashIdx+1:]
name = fmt.Sprintf("%s.%s", poolname, suffix)
Expand Down Expand Up @@ -118,6 +125,7 @@ func updateFromPod(pod *v1.Pod, what watch.EventType, cc chan events.ComponentUp

poolName, exists := pod.Labels["app.kubernetes.io/name"]
if exists {
poolName = strings.Replace(poolName, runname+"-", "", 1)
cc <- events.WorkerUpdate(name, pod.Namespace, poolName, platform.Kubernetes, workerStatus, what)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/observe/qstat/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func streamModel(runname, namespace string, follow bool, tail int64, quiet bool,
}

func poolName(worker Worker) string {
// test7f-pool1.w0.w96bh -> test7f-pool1
// test7f-pool1.w96bh -> test7f-pool1
if idx := strings.Index(worker.Name, "."); idx < 0 {
// TODO error handling here. what do we want to do?
return "INVALID: " + worker.Name
Expand Down

0 comments on commit 6047a56

Please sign in to comment.