From 15bd20cf65a250c24029b827d875b0be6f7ad43e Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Thu, 26 Dec 2024 09:58:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E5=90=AF=20job-backup=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=AD=A3=E5=9C=A8=E6=89=A7=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E5=BD=92=E6=A1=A3=E4=BB=BB=E5=8A=A1=E6=9C=AA=E6=97=A0=E6=8D=9F?= =?UTF-8?q?=E7=BB=88=E6=AD=A2=20#3359?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../archive/JobInstanceArchiveTaskScheduler.java | 10 +++++----- .../bk-job/templates/job-execute/deployment.yaml | 1 - support-files/kubernetes/charts/bk-job/values.yaml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/archive/JobInstanceArchiveTaskScheduler.java b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/archive/JobInstanceArchiveTaskScheduler.java index d882c8bd7e..c001df5c0c 100644 --- a/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/archive/JobInstanceArchiveTaskScheduler.java +++ b/src/backend/job-backup/service-job-backup/src/main/java/com/tencent/bk/job/backup/archive/JobInstanceArchiveTaskScheduler.java @@ -161,12 +161,12 @@ public void schedule() { watch.stop(); int taskConcurrent = archiveProperties.getTasks().getJobInstance().getConcurrent(); if (highestPriorityDbNodeTasksInfo.getRunningTaskCount() >= taskConcurrent) { - // 休眠5分钟,等待并行任务减少 - log.info("Running archive task count exceed concurrent limit : {}, wait 300s", taskConcurrent); + // 休眠1分钟,等待并行任务减少 + log.info("Running archive task count exceed concurrent limit : {}, wait 60s", taskConcurrent); // 释放锁 jobInstanceArchiveTaskScheduleLock.unlock(); locked = false; - ThreadUtils.sleep(1000 * 300L); + ThreadUtils.sleep(1000 * 60L); continue; } @@ -279,8 +279,8 @@ private void stopTasksGraceful() { } try { if (taskCountDownLatch != null) { - // 等待任务结束,最多等待 2min - boolean isAllTaskStopped = taskCountDownLatch.waitingForAllTasksDone(120); + // 等待任务结束,最多等待 10s(等待时间太长进程会被k8s kill掉) + boolean isAllTaskStopped = taskCountDownLatch.waitingForAllTasksDone(10); if (!isAllTaskStopped) { for (JobInstanceArchiveTask task : scheduledTasks.values()) { task.forceStopAtOnce(); diff --git a/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml b/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml index ff7e5c82a7..a369555869 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-execute/deployment.yaml @@ -34,7 +34,6 @@ spec: annotations: {{ include "annotations.sha256sum.configmap" ( dict "service" "job-execute" "context" . ) | nindent 8 }} spec: - {{- include "job.podTerminationGracePeriodSeconds" . | nindent 6 }} {{- include "job.imagePullSecrets" . | nindent 6 }} hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} {{- if .Values.executeConfig.affinity }} diff --git a/support-files/kubernetes/charts/bk-job/values.yaml b/support-files/kubernetes/charts/bk-job/values.yaml index cbdf5be5ae..6a6c1aa324 100644 --- a/support-files/kubernetes/charts/bk-job/values.yaml +++ b/support-files/kubernetes/charts/bk-job/values.yaml @@ -1807,4 +1807,4 @@ assembleConfig: readTimeout: 300000 # pod删除时等待优雅关闭的最大时间,单位为秒(超出后强制删除) -podTerminationGracePeriodSeconds: 40 +podTerminationGracePeriodSeconds: 60