Skip to content

Commit

Permalink
interTwin-eu#4 - fixed getStatus endpoint; at the moment it is working
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianco95 committed Apr 22, 2024
1 parent cf08025 commit 7fb86da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/docker/Status.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ func (h *SidecarHandler) StatusHandler(w http.ResponseWriter, r *http.Request) {
if execReturn.Stdout != "" {
if containerstatus[0] == "Created" {
log.G(h.Ctx).Info("-- Container " + containerName + " is going ready...")
resp[i].Containers = append(resp[i].Containers, v1.ContainerStatus{Name: containerName, State: v1.ContainerState{Waiting: &v1.ContainerStateWaiting{}}, Ready: false})
resp[i].Containers = append(resp[i].Containers,v1.ContainerStatus{Name: container.Name, State: v1.ContainerState{Waiting: &v1.ContainerStateWaiting{}}, Ready: false})
} else if containerstatus[0] == "Up" {
log.G(h.Ctx).Info("-- Container " + containerName + " is running")
resp[i].Containers = append(resp[i].Containers, v1.ContainerStatus{Name: containerName, State: v1.ContainerState{Running: &v1.ContainerStateRunning{}}, Ready: true})
resp[i].Containers = append(resp[i].Containers,v1.ContainerStatus{Name: container.Name, State: v1.ContainerState{Running: &v1.ContainerStateRunning{}}, Ready: true})
} else if containerstatus[0] == "Exited" {
log.G(h.Ctx).Info("-- Container " + containerName + " has been stopped")
resp[i].Containers = append(resp[i].Containers, v1.ContainerStatus{Name: containerName, State: v1.ContainerState{Terminated: &v1.ContainerStateTerminated{}}, Ready: false})
resp[i].Containers = append(resp[i].Containers,v1.ContainerStatus{Name: container.Name, State: v1.ContainerState{Terminated: &v1.ContainerStateTerminated{}}, Ready: false})
// release all the GPUs from the container
h.GpuManager.Release(containerName)
}
} else {
log.G(h.Ctx).Info("-- Container " + containerName + " doesn't exist")
resp[i].Containers = append(resp[i].Containers, v1.ContainerStatus{Name: containerName, State: v1.ContainerState{Terminated: &v1.ContainerStateTerminated{}}, Ready: false})
resp[i].Containers = append(resp[i].Containers, v1.ContainerStatus{Name: container.Name, State: v1.ContainerState{Terminated: &v1.ContainerStateTerminated{}}, Ready: false})
}
}
}
Expand Down

0 comments on commit 7fb86da

Please sign in to comment.