mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-15 20:22:01 +01:00
enhancement: add error log for create task (#17397)
Signed-off-by: chlins <chenyuzh@vmware.com> Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
8e7a630b0d
commit
24d60eb119
@ -197,6 +197,8 @@ func (e *executionManager) sweep(ctx context.Context, vendorType string, vendorI
|
||||
if !job.Status(execution.Status).Final() {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Debugf("delete execution %d by sweeper", execution.ID)
|
||||
if err = e.Delete(ctx, execution.ID); err != nil {
|
||||
// the execution may be deleted by the other sweep operation, ignore the not found error
|
||||
if errors.IsNotFoundErr(err) {
|
||||
@ -352,6 +354,8 @@ func (e *executionManager) Delete(ctx context.Context, id int64) error {
|
||||
return errors.New(nil).WithCode(errors.PreconditionCode).
|
||||
WithMessage("the execution %d has tasks that aren't in final status, stop the tasks first", id)
|
||||
}
|
||||
|
||||
log.Debugf("delete task %d as execution %d has been deleted", task.ID, task.ExecutionID)
|
||||
if err = e.taskDAO.Delete(ctx, task.ID); err != nil {
|
||||
// the tasks may be deleted by the other execution deletion operation in the same time(e.g. execution sweeper),
|
||||
// ignore the not found error for the tasks
|
||||
|
@ -95,6 +95,7 @@ func (m *manager) Create(ctx context.Context, executionID int64, jb *Job, extraA
|
||||
jobID, err := m.submitJob(ctx, id, jb)
|
||||
if err != nil {
|
||||
// failed to submit job to jobservice, delete the task record
|
||||
log.Errorf("delete task %d from db due to failed to submit job %v, error: %v", id, jb.Name, err)
|
||||
if err := m.dao.Delete(ctx, id); err != nil {
|
||||
log.Errorf("failed to delete the task %d: %v", id, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user