Skip to content
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

Add StartTime and CompletionTime in job status #89

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
.vscode/
vendor/
10 changes: 10 additions & 0 deletions pkg/apis/kubeflow/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,14 @@ type MPIJobStatus struct {
// The number of available worker replicas.
// +optional
WorkerReplicas int32 `json:"workerReplicas,omitempty"`

// 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.
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.
CompletionTime *metav1.Time `json:"completionTime,omitempty"`
}
10 changes: 9 additions & 1 deletion pkg/apis/kubeflow/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/controllers/mpi_job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,17 @@ func (c *MPIJobController) updateMPIJobStatus(mpiJob *kubeflow.MPIJob, launcher
// Or create a copy manually for better performance
mpiJobCopy := mpiJob.DeepCopy()
if launcher != nil {
now := metav1.Now()
if launcher.Status.Active > 0 {
mpiJobCopy.Status.LauncherStatus = kubeflow.LauncherActive
if mpiJobCopy.Status.StartTime == nil {
mpiJobCopy.Status.StartTime = &now
}
} else if launcher.Status.Succeeded > 0 {
mpiJobCopy.Status.LauncherStatus = kubeflow.LauncherSucceeded
if mpiJobCopy.Status.CompletionTime == nil {
mpiJobCopy.Status.CompletionTime = &now
}
} else if launcher.Status.Failed > 0 {
mpiJobCopy.Status.LauncherStatus = kubeflow.LauncherFailed
}
Expand Down
Loading