Skip to content

Commit

Permalink
Merge pull request #18 from Nimbus318/fix/tmp-hide-non-gpucontainers
Browse files Browse the repository at this point in the history
fix: temporarily hide non-GPU containers (e.g., sidecar) from task list
  • Loading branch information
Nimbus318 authored Jan 14, 2025
2 parents e476101 + f7cd67a commit 20721e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/internal/data/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,18 @@ func (r *podRepo) fetchContainerInfo(pod *corev1.Pod) []*biz.Container {
return containers
}

ctrIdMaps := map[string]string{}
containerStat := map[string]string{}
for _, ctr := range pod.Status.ContainerStatuses {
ctrIdMaps[ctr.Name] = ctr.ContainerID
containerStat[ctr.Name] = biz.ContainerStatusUnknown
if pod.Status.Phase == corev1.PodRunning && ctr.Ready {
containerStat[ctr.Name] = biz.ContainerStatusSuccess
} else if pod.Status.Phase == corev1.PodFailed {
containerStat[ctr.Name] = biz.ContainerStatusFailed
}
}
ctrIdMaps := map[string]string{}
for _, ctr := range pod.Status.ContainerStatuses {
ctrIdMaps[ctr.Name] = ctr.ContainerID
}

for i, ctr := range pod.Spec.Containers {
c := &biz.Container{
Name: ctr.Name,
Expand Down
4 changes: 4 additions & 0 deletions server/internal/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func (s *ContainerService) GetAllContainers(ctx context.Context, req *pb.GetAllC
deviceID = device.Id
}

if deviceID == "" {
continue
}

if filters.DeviceId != "" && !strings.HasPrefix(deviceID, filters.DeviceId) {
continue
}
Expand Down

0 comments on commit 20721e8

Please sign in to comment.