Skip to content

Commit

Permalink
Update ray.go not to fail when going suspend state. (#5816)
Browse files Browse the repository at this point in the history
Signed-off-by: Amin Maghsodi <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Co-authored-by: Kevin Su <[email protected]>
  • Loading branch information
aminmaghsodi and pingsutw authored Oct 23, 2024
1 parent 8bd573e commit 8890b38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions flyteplugins/go/tasks/plugins/k8s/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ func (plugin rayJobResourceHandler) GetTaskPhase(ctx context.Context, pluginCont
phaseInfo, err = pluginsCore.PhaseInfoRunning(pluginsCore.DefaultPhaseVersion, info), nil
case rayv1.JobDeploymentStatusComplete:
phaseInfo, err = pluginsCore.PhaseInfoSuccess(info), nil
case rayv1.JobDeploymentStatusSuspended:
phaseInfo, err = pluginsCore.PhaseInfoQueuedWithTaskInfo(time.Now(), pluginsCore.DefaultPhaseVersion, "Suspended", info), nil
case rayv1.JobDeploymentStatusSuspending:
phaseInfo, err = pluginsCore.PhaseInfoQueuedWithTaskInfo(time.Now(), pluginsCore.DefaultPhaseVersion, "Suspending", info), nil
case rayv1.JobDeploymentStatusFailed:
failInfo := fmt.Sprintf("Failed to run Ray job %s with error: [%s] %s", rayJob.Name, rayJob.Status.Reason, rayJob.Status.Message)
phaseInfo, err = pluginsCore.PhaseInfoFailure(flyteerr.TaskFailedWithError, failInfo, info), nil
Expand Down
3 changes: 2 additions & 1 deletion flyteplugins/go/tasks/plugins/k8s/ray/ray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,8 @@ func TestGetTaskPhase(t *testing.T) {
{rayv1.JobDeploymentStatusRunning, pluginsCore.PhaseRunning, false},
{rayv1.JobDeploymentStatusComplete, pluginsCore.PhaseSuccess, false},
{rayv1.JobDeploymentStatusFailed, pluginsCore.PhasePermanentFailure, false},
{rayv1.JobDeploymentStatusSuspended, pluginsCore.PhaseUndefined, true},
{rayv1.JobDeploymentStatusSuspended, pluginsCore.PhaseQueued, false},
{rayv1.JobDeploymentStatusSuspending, pluginsCore.PhaseQueued, false},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 8890b38

Please sign in to comment.