mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-27 13:02:59 +02:00
[cherry-pick] enhancement: add error log for create task (#17403)
enhancement: add error log for create task Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
d21b88eee4
commit
77734ef65d
@ -197,6 +197,8 @@ func (e *executionManager) sweep(ctx context.Context, vendorType string, vendorI
|
|||||||
if !job.Status(execution.Status).Final() {
|
if !job.Status(execution.Status).Final() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("delete execution %d by sweeper", execution.ID)
|
||||||
if err = e.Delete(ctx, execution.ID); err != nil {
|
if err = e.Delete(ctx, execution.ID); err != nil {
|
||||||
// the execution may be deleted by the other sweep operation, ignore the not found error
|
// the execution may be deleted by the other sweep operation, ignore the not found error
|
||||||
if errors.IsNotFoundErr(err) {
|
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).
|
return errors.New(nil).WithCode(errors.PreconditionCode).
|
||||||
WithMessage("the execution %d has tasks that aren't in final status, stop the tasks first", id)
|
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 {
|
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),
|
// 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
|
// 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)
|
jobID, err := m.submitJob(ctx, id, jb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// failed to submit job to jobservice, delete the task record
|
// 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 {
|
if err := m.dao.Delete(ctx, id); err != nil {
|
||||||
log.Errorf("failed to delete the task %d: %v", id, err)
|
log.Errorf("failed to delete the task %d: %v", id, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user