in pkg/aurorabridge/ptoa/schedule_status.go [28:87]
func NewScheduleStatus(s pod.PodState) (*api.ScheduleStatus, error) {
switch s {
case pod.PodState_POD_STATE_INVALID:
// Invalid state.
return api.ScheduleStatusInit.Ptr(), nil
case pod.PodState_POD_STATE_INITIALIZED:
// The pod is being initialized
return api.ScheduleStatusInit.Ptr(), nil
case pod.PodState_POD_STATE_PENDING:
// The pod is pending and waiting for resources
return api.ScheduleStatusPending.Ptr(), nil
case pod.PodState_POD_STATE_READY:
// The pod has been allocated with resources and ready for placement
return api.ScheduleStatusPending.Ptr(), nil
case pod.PodState_POD_STATE_PLACING:
// The pod is being placed to a host based on its resource
// requirements and constraints
return api.ScheduleStatusPending.Ptr(), nil
case pod.PodState_POD_STATE_PLACED:
// The pod has been assigned to a host matching the resource
// requirements and constraints
return api.ScheduleStatusAssigned.Ptr(), nil
case pod.PodState_POD_STATE_LAUNCHING:
// The pod is taken from resmgr to be launched
return api.ScheduleStatusAssigned.Ptr(), nil
case pod.PodState_POD_STATE_LAUNCHED:
// The pod is being launched in Job manager
return api.ScheduleStatusAssigned.Ptr(), nil
case pod.PodState_POD_STATE_STARTING:
// Either init containers are starting/running or the main containers
// in the pod are being started by Mesos agent
return api.ScheduleStatusStarting.Ptr(), nil
case pod.PodState_POD_STATE_RUNNING:
// All containers in the pod are running
return api.ScheduleStatusRunning.Ptr(), nil
case pod.PodState_POD_STATE_SUCCEEDED:
// All containers in the pod terminated with an exit code of zero
return api.ScheduleStatusFinished.Ptr(), nil
case pod.PodState_POD_STATE_FAILED:
// At least on container in the pod terminated with a non-zero exit code
return api.ScheduleStatusFailed.Ptr(), nil
case pod.PodState_POD_STATE_LOST:
// The pod is lost
return api.ScheduleStatusLost.Ptr(), nil
case pod.PodState_POD_STATE_KILLING:
// The pod is being killed
return api.ScheduleStatusKilling.Ptr(), nil
case pod.PodState_POD_STATE_KILLED:
// At least one of the containers in the pod was terminated by the system
return api.ScheduleStatusKilled.Ptr(), nil
case pod.PodState_POD_STATE_PREEMPTING:
// The pod is being preempted by another one on the node
return api.ScheduleStatusPreempting.Ptr(), nil
case pod.PodState_POD_STATE_DELETED:
// The pod is to be deleted after termination
return api.ScheduleStatusKilled.Ptr(), nil
default:
return nil, fmt.Errorf("unknown pod state: %d", s)
}
}