Skip to content

Commit

Permalink
Merge pull request #549 from danielvegamyhre/comment
Browse files Browse the repository at this point in the history
Add comment explaining why we don't unconditionally compute firstFailedJob
  • Loading branch information
k8s-ci-robot authored Apr 25, 2024
2 parents c986e5f + 2f728c7 commit 3ae60bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,10 @@ func executeSuccessPolicy(ctx context.Context, js *jobset.JobSet, ownedJobs *chi
func executeFailurePolicy(ctx context.Context, js *jobset.JobSet, ownedJobs *childJobs, updateStatusOpts *statusUpdateOpts) {
// If no failure policy is defined, mark the JobSet as failed.
if js.Spec.FailurePolicy == nil {
// firstFailedJob is only computed if necessary since it is expensive to compute
// for JobSets with many child jobs. This is why we don't unconditionally compute
// it once at the beginning of the function and share the results between the different
// possible code paths here.
firstFailedJob := findFirstFailedJob(ownedJobs.failed)
setJobSetFailedCondition(ctx, js, constants.FailedJobsReason, messageWithFirstFailedJob(constants.FailedJobsMessage, firstFailedJob.Name), updateStatusOpts)
return
Expand Down

0 comments on commit 3ae60bb

Please sign in to comment.