Skip to content

Commit

Permalink
fix: delete active jobs right away when job finishes even when TTLSec…
Browse files Browse the repository at this point in the history
…ondsAfterFinished is set (#667)

change order
  • Loading branch information
CecileRobertMichon authored Aug 31, 2024
1 parent 2dcc751 commit 5b1c46f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ func (r *JobSetReconciler) reconcile(ctx context.Context, js *jobset.JobSet, upd

// If JobSet is already completed or failed, clean up active child jobs and requeue if TTLSecondsAfterFinished is set.
if jobSetFinished(js) {
if err := r.deleteJobs(ctx, ownedJobs.active); err != nil {
log.Error(err, "deleting jobs")
return ctrl.Result{}, err
}
requeueAfter, err := executeTTLAfterFinishedPolicy(ctx, r.Client, r.clock, js)
if err != nil {
log.Error(err, "executing ttl after finished policy")
Expand All @@ -162,10 +166,6 @@ func (r *JobSetReconciler) reconcile(ctx context.Context, js *jobset.JobSet, upd
if requeueAfter > 0 {
return ctrl.Result{RequeueAfter: requeueAfter}, nil
}
if err := r.deleteJobs(ctx, ownedJobs.active); err != nil {
log.Error(err, "deleting jobs")
return ctrl.Result{}, err
}
return ctrl.Result{}, nil
}

Expand Down

0 comments on commit 5b1c46f

Please sign in to comment.