From 4e217ceb5185987cde8b4600d48d75260cc2c1a2 Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Mon, 19 Feb 2024 16:18:56 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20Job=20=E6=94=AF=E6=8C=81=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E6=89=A7=E8=A1=8C=20-=20=E8=84=9A=E6=9C=AC=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=20#2631?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TaskExecuteServiceImpl.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java index b6ea557ad2..36940020ca 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/service/impl/TaskExecuteServiceImpl.java @@ -349,8 +349,7 @@ private TaskInstanceExecuteObjects processExecuteObjects(TaskInstanceDTO taskIns acquireAndSetHosts(taskInstanceExecuteObjects, taskInstance, stepInstanceList, variables); acquireAndSetContainers(taskInstanceExecuteObjects, taskInstance, stepInstanceList); boolean isSupportExecuteObjectFeature = isSupportExecuteObjectFeature(taskInstance); - stepInstanceList.forEach(stepInstance -> - stepInstance.buildStepFinalExecuteObjects(isSupportExecuteObjectFeature)); + mergeExecuteObjects(stepInstanceList, variables, isSupportExecuteObjectFeature); checkExecuteObjectExist(taskInstanceExecuteObjects); watch.stop(); @@ -381,6 +380,21 @@ private TaskInstanceExecuteObjects processExecuteObjects(TaskInstanceDTO taskIns } } + private void mergeExecuteObjects(List stepInstanceList, + Collection variables, + boolean isSupportExecuteObjectFeature) { + stepInstanceList.forEach(stepInstance -> + stepInstance.buildStepFinalExecuteObjects(isSupportExecuteObjectFeature)); + if (CollectionUtils.isNotEmpty(variables)) { + variables.forEach(variable -> { + if (TaskVariableTypeEnum.HOST_LIST.getType() == variable.getType() + && variable.getTargetServers() != null) { + variable.getTargetServers().buildMergedExecuteObjects(isSupportExecuteObjectFeature); + } + }); + } + } + private boolean isSupportExecuteObjectFeature(TaskInstanceDTO taskInstance) { FeatureExecutionContext featureExecutionContext = FeatureExecutionContext.builder()