[Fix-14721] [K8S Task] Handle job delete event when user manually delete the job in k8s cluster (#14722)

Co-authored-by: Jay Chung <zhongjiajie955@gmail.com>
This commit is contained in:
Aaron Wang 2023-08-11 17:15:07 +08:00 committed by GitHub
parent 8e64026e93
commit cb55476235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -198,7 +198,11 @@ public class K8sTaskExecutor extends AbstractK8sTaskExecutor {
final LogUtils.MDCAutoClosableContext mdcAutoClosableContext =
LogUtils.setTaskInstanceLogFullPathMDC(taskRequest.getLogPath())) {
log.info("event received : job:{} action:{}", job.getMetadata().getName(), action);
if (action != Action.ADDED) {
if (action == Action.DELETED) {
log.error("[K8sJobExecutor-{}] fail in k8s", job.getMetadata().getName());
taskResponse.setExitStatusCode(EXIT_CODE_FAILURE);
countDownLatch.countDown();
} else if (action != Action.ADDED) {
int jobStatus = getK8sJobStatus(job);
log.info("job {} status {}", job.getMetadata().getName(), jobStatus);
if (jobStatus == TaskConstants.RUNNING_CODE) {