Skip to content

Commit

Permalink
supporting external deletion of non-terminal subtasks (flyteorg#278)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Jul 26, 2022
1 parent 574bd14 commit e917d85
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions flyteplugins/go/tasks/plugins/array/k8s/subtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,15 @@ func getSubtaskPhaseInfo(ctx context.Context, stCtx SubTaskExecutionContext, cfg
return pluginsCore.PhaseInfoUndefined, err
}

if !phaseInfo.Phase().IsTerminal() && o.GetDeletionTimestamp() != nil {
// If the object has been deleted, that is, it has a deletion timestamp, but is not in a terminal state, we should
// mark the task as a retryable failure. We've seen this happen when a kubelet disappears - all pods running on
// the node are marked with a deletionTimestamp, but our finalizers prevent the pod from being deleted.
// This can also happen when a user deletes a Pod directly.
failureReason := fmt.Sprintf("object [%s] terminated in the background, manually", nsName.String())
return pluginsCore.PhaseInfoSystemRetryableFailure("UnexpectedObjectDeletion", failureReason, nil), nil
}

return phaseInfo, err
}

Expand Down

0 comments on commit e917d85

Please sign in to comment.