Skip to content

Commit

Permalink
wrap job creation error in msg including job name
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Mar 14, 2024
1 parent 281deca commit 54f3809
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func (r *JobSetReconciler) createJobs(ctx context.Context, js *jobset.JobSet, ow
if err := r.Create(ctx, job); err != nil {
lock.Lock()
defer lock.Unlock()
finalErrs = append(finalErrs, err)
finalErrs = append(finalErrs, fmt.Errorf("job %q creation failed with error: %v", job.Name, err))
return
}
log.V(2).Info("successfully created job", "job", klog.KObj(job))
Expand All @@ -477,7 +477,7 @@ func (r *JobSetReconciler) createJobs(ctx context.Context, js *jobset.JobSet, ow
if allErrs != nil {
// Emit event to propagate the Job creation failures up to be more visible to the user.
// TODO(#422): Investigate ways to validate Job templates at JobSet validation time.
r.Record.Eventf(js, corev1.EventTypeWarning, "JobCreationFailed", "Job creation(s) failed with error: %s", allErrs)
r.Record.Eventf(js, corev1.EventTypeWarning, "JobCreationFailed", allErrs.Error())
return allErrs
}
// Skip emitting a condition for StartupPolicy if JobSet is suspended
Expand Down

0 comments on commit 54f3809

Please sign in to comment.