Skip to content

Commit

Permalink
add comment explaining duplicate function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Apr 25, 2024
1 parent c986e5f commit 2f728c7
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 2f728c7

Please sign in to comment.