Skip to content

Commit

Permalink
chore(controller): adjust log level
Browse files Browse the repository at this point in the history
  • Loading branch information
Jian Zeng committed Nov 25, 2020
1 parent f3f9dd1 commit b2e5c89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pkg/workflow/workflowrun/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,10 @@ func (o *operator) Reconcile() (controller.Result, error) {
if err != nil {
if isExceededQuotaError(err) {
retryStageNames = append(retryStageNames, stage)
log.WithField("wfr", o.wfr.Name).WithField("stg", stage).Warningf("Process workload error: ", err)
} else {
log.WithField("wfr", o.wfr.Name).WithField("stg", stage).Error("Process workload error: ", err)
}
log.WithField("stg", stage).Error("Process workload error: ", err)
continue
}
}
Expand Down
6 changes: 2 additions & 4 deletions pkg/workflow/workflowrun/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,19 @@ func (p *WorkloadProcessor) processPod() error {
// Generate pod for this stage.
po, err := pod.NewBuilder(p.client, p.wf, p.wfr, p.stg).Build()
if err != nil {
log.WithField("wfr", p.wfr.Name).WithField("stg", p.stg.Name).Error("Create pod manifest for stage error: ", err)
p.wfrOper.GetRecorder().Eventf(p.wfr, corev1.EventTypeWarning, "GeneratePodSpecError", "Generate pod for stage '%s' error: %v", p.stg.Name, err)
p.wfrOper.UpdateStageStatus(p.stg.Name, &v1alpha1.Status{
Phase: v1alpha1.StatusFailed,
Reason: "GeneratePodError",
LastTransitionTime: metav1.Time{Time: time.Now()},
Message: fmt.Sprintf("Failed to generate pod: %v", err),
})
return err
return fmt.Errorf("create pod manifest: %w", err)
}
log.WithField("stg", p.stg.Name).Debug("Pod manifest created")

po, err = p.clusterClient.CoreV1().Pods(pod.GetExecutionContext(p.wfr).Namespace).Create(po)
if err != nil {
log.WithField("wfr", p.wfr.Name).WithField("stg", p.stg.Name).Error("Create pod for stage error: ", err)
p.wfrOper.GetRecorder().Eventf(p.wfr, corev1.EventTypeWarning, "StagePodCreated", "Create pod for stage '%s' error: %v", p.stg.Name, err)
var phase v1alpha1.StatusPhase
if isExceededQuotaError(err) {
Expand All @@ -94,7 +92,7 @@ func (p *WorkloadProcessor) processPod() error {
LastTransitionTime: metav1.Time{Time: time.Now()},
Message: fmt.Sprintf("Failed to create pod: %v", err),
})
return err
return fmt.Errorf("create pod: %w", err)
}

log.WithField("wfr", p.wfr.Name).WithField("stg", p.stg.Name).Debug("Create pod for stage succeeded")
Expand Down

0 comments on commit b2e5c89

Please sign in to comment.