-
Notifications
You must be signed in to change notification settings - Fork 232
Use local copy of JobStatus by mpi-operator #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,8 @@ import ( | |
| type MPIJob struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
| Spec MPIJobSpec `json:"spec,omitempty"` | ||
| Status common.JobStatus `json:"status,omitempty"` | ||
| Spec MPIJobSpec `json:"spec,omitempty"` | ||
| Status JobStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
|
@@ -114,7 +114,7 @@ type MPIJobSpec struct { | |
| } | ||
|
|
||
| // MPIReplicaType is the type for MPIReplica. | ||
| type MPIReplicaType common.ReplicaType | ||
| type MPIReplicaType string | ||
|
|
||
| const ( | ||
| // MPIReplicaTypeLauncher is the type for launcher replica. | ||
|
|
@@ -130,3 +130,117 @@ const ( | |
| MPIImplementationOpenMPI MPIImplementation = "OpenMPI" | ||
| MPIImplementationIntel MPIImplementation = "Intel" | ||
| ) | ||
|
|
||
| // JobStatus represents the current observed state of the training Job. | ||
| type JobStatus struct { | ||
| // conditions is a list of current observed job conditions. | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=type | ||
| Conditions []JobCondition `json:"conditions,omitempty"` | ||
|
|
||
| // replicaStatuses is map of ReplicaType and ReplicaStatus, | ||
| // specifies the status of each replica. | ||
| // +optional | ||
| ReplicaStatuses map[MPIReplicaType]*ReplicaStatus `json:"replicaStatuses,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another violation of API conventions T_T
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's right :( |
||
|
|
||
| // Represents time when the job was acknowledged by the job controller. | ||
| // It is not guaranteed to be set in happens-before order across separate operations. | ||
| // It is represented in RFC3339 form and is in UTC. | ||
| // +optional | ||
| StartTime *metav1.Time `json:"startTime,omitempty"` | ||
|
|
||
| // Represents time when the job was completed. It is not guaranteed to | ||
| // be set in happens-before order across separate operations. | ||
| // It is represented in RFC3339 form and is in UTC. | ||
| // +optional | ||
| CompletionTime *metav1.Time `json:"completionTime,omitempty"` | ||
|
|
||
| // Represents last time when the job was reconciled. It is not guaranteed to | ||
| // be set in happens-before order across separate operations. | ||
| // It is represented in RFC3339 form and is in UTC. | ||
| // +optional | ||
| LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"` | ||
| } | ||
|
|
||
| // ReplicaStatus represents the current observed state of the replica. | ||
| type ReplicaStatus struct { | ||
| // The number of actively running pods. | ||
| // +optional | ||
| Active int32 `json:"active,omitempty"` | ||
|
|
||
| // The number of pods which reached phase succeeded. | ||
| // +optional | ||
| Succeeded int32 `json:"succeeded,omitempty"` | ||
|
|
||
| // The number of pods which reached phase failed. | ||
| // +optional | ||
| Failed int32 `json:"failed,omitempty"` | ||
|
|
||
| // Deprecated: Use selector instead | ||
| // +optional | ||
| LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"` | ||
|
|
||
| // A selector is a label query over a set of resources. The result of matchLabels and | ||
| // matchExpressions are ANDed. An empty selector matches all objects. A null | ||
| // selector matches no objects. | ||
| // +optional | ||
| Selector string `json:"selector,omitempty"` | ||
| } | ||
|
|
||
| // JobCondition describes the state of the job at a certain point. | ||
| type JobCondition struct { | ||
| // type of job condition. | ||
| Type JobConditionType `json:"type"` | ||
|
|
||
| // status of the condition, one of True, False, Unknown. | ||
| // +kubebuilder:validation:Enum:=True;False;Unknown | ||
| Status v1.ConditionStatus `json:"status"` | ||
|
|
||
| // The reason for the condition's last transition. | ||
| // +optional | ||
| Reason string `json:"reason,omitempty"` | ||
|
|
||
| // A human-readable message indicating details about the transition. | ||
| // +optional | ||
| Message string `json:"message,omitempty"` | ||
|
|
||
| // The last time this condition was updated. | ||
| // +optional | ||
| LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` | ||
|
|
||
| // Last time the condition transitioned from one status to another. | ||
| // +optional | ||
| LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
| } | ||
|
|
||
| // JobConditionType defines all kinds of types of JobStatus. | ||
| type JobConditionType string | ||
|
|
||
| const ( | ||
| // JobCreated means the job has been accepted by the system, | ||
| // but one or more of the pods/services has not been started. | ||
| // This includes time before pods being scheduled and launched. | ||
| JobCreated JobConditionType = "Created" | ||
|
|
||
| // JobRunning means all sub-resources (e.g. services/pods) of this job | ||
| // have been successfully scheduled and launched. | ||
| // The training is running without error. | ||
| JobRunning JobConditionType = "Running" | ||
|
|
||
| // JobRestarting means one or more sub-resources (e.g. services/pods) of this job | ||
| // reached phase failed but maybe restarted according to it's restart policy | ||
| // which specified by user in v1.PodTemplateSpec. | ||
| // The training is freezing/pending. | ||
| JobRestarting JobConditionType = "Restarting" | ||
|
|
||
| // JobSucceeded means all sub-resources (e.g. services/pods) of this job | ||
| // reached phase have terminated in success. | ||
| // The training is complete without error. | ||
| JobSucceeded JobConditionType = "Succeeded" | ||
|
|
||
| // JobFailed means one or more sub-resources (e.g. services/pods) of this job | ||
| // reached phase failed with no restarting. | ||
| // The training has failed its execution. | ||
| JobFailed JobConditionType = "Failed" | ||
| ) | ||
Uh oh!
There was an error while loading. Please reload this page.