Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func GetPhaseInfo(currentCondition kubeflowv1.JobCondition, occurredAt time.Time
return pluginsCore.PhaseInfoRetryableFailure(flyteerr.DownstreamSystemError, details, &taskPhaseInfo), nil
case kubeflowv1.JobRestarting:
return pluginsCore.PhaseInfoRunning(pluginsCore.DefaultPhaseVersion, &taskPhaseInfo), nil
case kubeflowv1.JobSuspended:
return pluginsCore.PhaseInfoQueuedWithTaskInfo(pluginsCore.DefaultPhaseVersion, "Suspended", &taskPhaseInfo), nil
}

return pluginsCore.PhaseInfoUndefined, nil
Expand All @@ -83,6 +85,8 @@ func GetMPIPhaseInfo(currentCondition kubeflowv1.JobCondition, occurredAt time.T
return pluginsCore.PhaseInfoRetryableFailure(flyteerr.DownstreamSystemError, details, &taskPhaseInfo), nil
case kubeflowv1.JobRestarting:
return pluginsCore.PhaseInfoRunning(pluginsCore.DefaultPhaseVersion, &taskPhaseInfo), nil
case kubeflowv1.JobSuspended:
return pluginsCore.PhaseInfoQueuedWithTaskInfo(pluginsCore.DefaultPhaseVersion, "Suspended", &taskPhaseInfo), nil
}

return pluginsCore.PhaseInfoUndefined, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ func TestGetPhaseInfo(t *testing.T) {
assert.Equal(t, pluginsCore.PhaseRunning, taskPhase.Phase())
assert.NotNil(t, taskPhase.Info())
assert.Nil(t, err)

jobSuspended := kubeflowv1.JobCondition{
Type: kubeflowv1.JobSuspended,
}
taskPhase, err = GetPhaseInfo(jobSuspended, time.Now(), pluginsCore.TaskInfo{})
assert.NoError(t, err)
assert.Equal(t, pluginsCore.PhaseQueued, taskPhase.Phase())
assert.NotNil(t, taskPhase.Info())
assert.Nil(t, err)
}

func TestGetMPIPhaseInfo(t *testing.T) {
Expand Down Expand Up @@ -161,6 +170,15 @@ func TestGetMPIPhaseInfo(t *testing.T) {
assert.Equal(t, pluginsCore.PhaseRunning, taskPhase.Phase())
assert.NotNil(t, taskPhase.Info())
assert.Nil(t, err)

jobSuspended := kubeflowv1.JobCondition{
Type: kubeflowv1.JobSuspended,
}
taskPhase, err = GetMPIPhaseInfo(jobSuspended, time.Now(), pluginsCore.TaskInfo{})
assert.NoError(t, err)
assert.Equal(t, pluginsCore.PhaseQueued, taskPhase.Phase())
assert.NotNil(t, taskPhase.Info())
assert.Nil(t, err)
}

func TestGetLogs(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func TestGetTaskPhase(t *testing.T) {
assert.Equal(t, pluginsCore.PhaseInfoUndefined, taskPhase)

// Training operator did not modify the job because it is suspended
mpiJobSuspended := dummyMPIJobResourceCreator(kubeflowv1.JobCreated)
mpiJobSuspended := dummyMPIJobResourceCreator(kubeflowv1.JobSuspended)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the job was just created, we do treat this as "phase info queued" so the behavior that is tested here is correct, let's not remove coverage but add another text case for suspended please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the two files below as well please.

mpiJobSuspended.CreationTimestamp = v1.Time{Time: time.Now().Add(-time.Hour)}
mpiJobSuspended.Status.StartTime = nil
suspend := true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ func TestGetTaskPhase(t *testing.T) {
assert.Equal(t, pluginsCore.PhaseInfoUndefined, taskPhase)

// Training operator did not modify the job because it is suspended
pytorchJobSuspended := dummyPytorchJobResourceCreator(kubeflowv1.JobCreated)
pytorchJobSuspended := dummyPytorchJobResourceCreator(kubeflowv1.JobSuspended)
pytorchJobSuspended.CreationTimestamp = v1.Time{Time: time.Now().Add(-time.Hour)}
pytorchJobSuspended.Status.StartTime = nil
suspend := true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func TestGetTaskPhase(t *testing.T) {
assert.Equal(t, pluginsCore.PhaseInfoUndefined, taskPhase)

// Training operator did not modify the job because it is suspended
tfJobSuspended := dummyTensorFlowJobResourceCreator(kubeflowv1.JobCreated)
tfJobSuspended := dummyTensorFlowJobResourceCreator(kubeflowv1.JobSuspended)
tfJobSuspended.CreationTimestamp = v1.Time{Time: time.Now().Add(-time.Hour)}
tfJobSuspended.Status.StartTime = nil
suspend := true
Expand Down