Skip to content

Commit

Permalink
fix: terminate job and release resources when drop job out of queue
Browse files Browse the repository at this point in the history
Signed-off-by: merryzhou <merryzhou0882@gmail.com>
  • Loading branch information
merryzhou committed Nov 9, 2020
1 parent 63f81be commit b5835b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controllers/job/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ func (cc *jobcontroller) processNextReq(count uint32) bool {
}
cc.recordJobEvent(jobInfo.Job.Namespace, jobInfo.Job.Name, batchv1alpha1.ExecuteAction, fmt.Sprintf(
"Job failed on action %s for retry limit reached", action))
klog.Warningf("Terminating Job <%s/%s> and releasing resources", jobInfo.Job.Namespace, jobInfo.Job.Name)
if err = st.Execute(busv1alpha1.TerminateJobAction); err != nil {
klog.Errorf("Failed to terminate Job<%s/%s>: %v", jobInfo.Job.Namespace, jobInfo.Job.Name, err)
}
klog.Warningf("Dropping job<%s/%s> out of the queue: %v because max retries has reached", jobInfo.Job.Namespace, jobInfo.Job.Name, err)
}

Expand Down

0 comments on commit b5835b2

Please sign in to comment.