From 0da7a776c2ebe90a88f87cd97f3a12b3aaa990ab Mon Sep 17 00:00:00 2001 From: "jinchunzhao@yzbdl.ac.cn" Date: Wed, 14 Sep 2022 14:45:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/impl/KettleExecutorHandler.java | 13 +++++++++---- .../service/task/impl/TaskInstanceServiceImpl.java | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java index 1e480e1..6a4b353 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java @@ -210,11 +210,13 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand TaskInstanceResourceDTO taskInstanceResourceDTO = taskInstanceService.getTaskInstanceResourceIgnoreTenantId(taskInstanceId); if (Objects.isNull(taskInstanceResourceDTO)) { + log.warn("任务实例:{},未找到任务实例资源", taskInstanceId); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } // 获取entranceName TaskResourceEntity taskResourceEntity = taskInstanceResourceDTO.getTaskResourceEntity(); if (Objects.isNull(taskResourceEntity)) { + log.warn("任务实例:{},未找到任务资源", taskInstanceId); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } @@ -222,6 +224,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand Integer resourceType = taskInstanceResourceDTO.getTaskResourceEntity().getResourceType(); ResourceTypeInvokerHandler handler = ResourceTypeFactory.getHandler(resourceType.toString()); if (Objects.isNull(handler)) { + log.warn("任务实例:{},未找到任务资源类型{}", taskInstanceId, resourceType); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } @@ -229,10 +232,12 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand ServerProgramInfoDTO serverProgram = serverProgramService.getServerProgramInfoByIdIgnoreTenantId(serverProgramId); if (Objects.isNull(serverProgram) || Objects.isNull(serverProgram.getServerEntity())) { + log.warn("任务实例:{},未找到服务节点信息", taskInstanceId); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } String value = ResourceTypeEnum.matchValue(resourceType); if (StringUtils.isBlank(value)) { + log.warn("任务实例:{},任务资源类型不匹配{}", taskInstanceId, resourceType); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } @@ -651,7 +656,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand private Document getKettleDocument(TaskResourceEntity taskResourceEntity, String baseUrl, String taskInfo, String authConfig, Long LogLineNumber) throws Exception { String result = executorFetchKettleXmlRequest(taskResourceEntity, baseUrl, taskInfo, authConfig, LogLineNumber); - log.error("----------------------转换执行结果返回xml:{}", result); + log.debug("转换执行结果返回xml:{}", result); if (StringUtils.isNotBlank(result)) { if (result.equals(RES_SERVER_ERROR)) { log.error("获取任务执行结果,服务器错误!"); @@ -769,7 +774,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand isContinue = taskMonitorThreadVO.getIsContinue(); - log.error("日志行数--》:{},是否继续操作:{}", logLineNumber, isContinue); + log.error("日志行数:{},是否继续操作:{}", logLineNumber, isContinue); } } catch (Exception e) { log.error("任务:{}监控异常!执行器记录ID:{} \r\n错误原因:{} \r\n", taskName, carteObjectId, e); @@ -821,7 +826,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand // 从xml中获取状态描述 String statusText = parsingTaskStatusNode(xmlNode); - log.error("获取日志拿到的状态是什么鬼:{}", statusText); + log.debug("获取日志拿到的状态:{}", statusText); Node loggingString = XMLHandler.getSubNode(xmlNode, KettleXmlConstant.LOGGING_STR); if (Objects.isNull(loggingString)) { @@ -941,7 +946,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand saveTaskStepLog(taskStepLogs); } } catch (Exception e) { - log.error("---------------解析步骤日志:转换 xml 对象异常!!!!!", e); + log.error("解析步骤日志:转换 xml 对象异常!!!!!", e); } } diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/service/task/impl/TaskInstanceServiceImpl.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/service/task/impl/TaskInstanceServiceImpl.java index d6d8f97..99692d4 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/service/task/impl/TaskInstanceServiceImpl.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/service/task/impl/TaskInstanceServiceImpl.java @@ -148,6 +148,7 @@ public class TaskInstanceServiceImpl implements TaskInstanceService { ProgramCategoryExecutorInvokerHandler handler = ProgramCategoryExecutorFactory.getHandler(serverProgramEntity.getCategory().toString()); if (Objects.isNull(handler)) { + log.warn("任务实例:{},未找到服务节点类型{}",taskInstanceId, serverProgramEntity.getCategory() ); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } -- Gitee From 8dbcc58ad174cb930a9c0963114a3975f958da49 Mon Sep 17 00:00:00 2001 From: "jinchunzhao@yzbdl.ac.cn" Date: Wed, 14 Sep 2022 14:47:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89---?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java index 2451f31..6a1286f 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java @@ -85,7 +85,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { */ private void callTaskPlanTask(JobDataMap jobDataMap) { String currentDate = DateUtil.format(new Date(), DateUtil.DATE_FORMAT_SECOND); - log.info("---------------------开始执行定时任务----------------------,{}", currentDate); + log.info("开始执行定时任务 {}", currentDate); Long nodeId = jobDataMap.getLong(TaskPlanSchedulerConstant.TASK_PLAN_NODE_ID); Long taskPlanId = jobDataMap.getLong(TaskPlanSchedulerConstant.TASK_PLAN_ID); -- Gitee From 316be7db3835043ef779cb866eb1a52cd2b8fb33 Mon Sep 17 00:00:00 2001 From: "jinchunzhao@yzbdl.ac.cn" Date: Wed, 14 Sep 2022 14:54:40 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=A7=84=E8=8C=83=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/impl/KettleExecutorHandler.java | 8 ++++---- .../quartz/taskplan/TaskPlanQuartzTaskJob.java | 14 +++++++------- .../lanius/orchestrate/serv/utils/HttpUtil.java | 8 ++++++++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java index 6a4b353..55c0051 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/handler/category/impl/KettleExecutorHandler.java @@ -1256,13 +1256,13 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand String stopped = TransJobStatusEnum.STOPPED.getName(); String paused = TransJobStatusEnum.PAUSED.getName(); if (Objects.equals(statusText, finished)) { - log.info("任务:{},执行器记录ID:【{}】 任务执行完成...", taskName, carteObjectId); + log.debug("任务:{},执行器记录ID:【{}】 任务执行完成...", taskName, carteObjectId); updateTaskInstanceStatus(taskInstanceId, TaskInstanceStatusEnum.SUCCESS.getCode(), null); } else if (Objects.equals(statusText, stopped)) { - log.info("任务:{},执行器记录ID:【{}】 任务执行已停止...", taskName, carteObjectId); + log.debug("任务:{},执行器记录ID:【{}】 任务执行已停止...", taskName, carteObjectId); updateTaskInstanceStatus(taskInstanceId, TaskInstanceStatusEnum.FAIL.getCode(), null); } else if (Objects.equals(statusText, paused)) { - log.info("任务:{},执行器记录ID:【{}】 任务执行被暂停...", taskName, carteObjectId); + log.debug("任务:{},执行器记录ID:【{}】 任务执行被暂停...", taskName, carteObjectId); updateTaskInstanceStatus(taskInstanceId, TaskInstanceStatusEnum.FAIL.getCode(), null); } else { // TODO halting 最好排查转换、避免这个状态,同时调用--停止这个任务进程。 @@ -1305,7 +1305,7 @@ public class KettleExecutorHandler implements ProgramCategoryExecutorInvokerHand String userName = map.get(ServerNodeAuthConfigConstant.USERNAME); String password = map.get(ServerNodeAuthConfigConstant.PASSWORD); String result = HttpPostUtils.getInstance().post(queryUrl.toString(), getAuthorization(userName, password)); - log.info("对象ID:{},执行记录删除结果:{}", carteObjectId, result); + log.debug("对象ID:{},执行记录删除结果:{}", carteObjectId, result); } } diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java index 6a1286f..cc831db 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/quartz/taskplan/TaskPlanQuartzTaskJob.java @@ -98,7 +98,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { Long taskInstanceId = null; if (Objects.isNull(taskPlanResourceDTO)) { - log.info("执行任务编排调度任务:未查询到任务编排数据!"); + log.warn("执行任务编排调度任务:未查询到任务编排数据!"); taskInstanceId = skipTaskInstance(nodeId,-1L, taskPlanId, -1L,logLevel); String msg = String.format("%s - 执行任务编排调度任务:未查询到任务编排数据!\r\n", currentDate); @@ -114,7 +114,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { // 检验任务编排状态 Integer taskPlanStatus = taskPlanResourceDTO.getStatus(); if (Objects.equals(taskPlanStatus, TaskStatusEnum.DISABLED.getCode())) { - log.info("任务编排:【{}】已被禁用,不能执行任务!", taskName); + log.warn("任务编排:【{}】已被禁用,不能执行任务!", taskName); taskInstanceId = skipTaskInstance(serverProgramId,taskResourceId, taskPlanId, taskPlanResourceDTO.getOrgId(),logLevel); String msg = String.format("%s - 任务编排:【%s】已被禁用,不能执行任务!\r\n", currentDate,taskName); @@ -126,7 +126,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { TaskResourceConfigEntity taskResourceConfigEntity = taskPlanResourceDTO.getTaskResourceConfigEntity(); Integer status = taskResourceConfigEntity.getStatus(); if (Objects.equals(status, ResourceDataStatusEnum.ABNORMAL.getCode())) { - log.info("任务编排:【{}】关联任务资源配置异常,不能执行任务!", taskName); + log.warn("任务编排:【{}】关联任务资源配置异常,不能执行任务!", taskName); taskInstanceId = skipTaskInstance(serverProgramId,taskResourceId, taskPlanId, taskPlanResourceDTO.getOrgId(),logLevel); String msg = String.format("%s - 任务编排:【%s】关联任务资源配置异常,不能执行任务!\r\n", currentDate,taskName); @@ -137,7 +137,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { // 1. 检测是否可以并行执行任务 if (!isParallel(jobDataMap)) { - log.debug("任务编排:【{}】存在运行中的实例,不能并行执行任务!", taskName); + log.warn("任务编排:【{}】存在运行中的实例,不能并行执行任务!", taskName); // 跳过该计划 taskInstanceId = skipTaskInstance(serverProgramId,taskResourceId, taskPlanId, taskPlanResourceDTO.getOrgId(),logLevel); @@ -181,7 +181,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { Long orgId = taskPlanResourceDTO.getOrgId(); Long taskPlanId = taskPlanResourceDTO.getId(); if (Objects.isNull(serverProgram)) { - log.error("执行任务编排调度任务:未查询到服务节点数据!--调度结束"); + log.warn("执行任务编排调度任务:未查询到服务节点数据!--调度结束"); updateTaskInstanceStatus(taskInstance.getId(), TaskInstanceStatusEnum.SKIP.getCode()); String msg = String.format("%s - 执行任务编排调度任务【%s】:未查询到服务节点数据!--调度结束\r\n", currentDate, taskPlanResourceDTO.getTaskName()); @@ -192,7 +192,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { Integer programCategory = serverProgram.getCategory(); if (Objects.isNull(programCategory)) { - log.error("执行任务编排调度任务:未查询到服务节点程序类型数据!--调度结束"); + log.warn("执行任务编排调度任务:未查询到服务节点程序类型数据!--调度结束"); updateTaskInstanceStatus(taskInstance.getId(), TaskInstanceStatusEnum.SKIP.getCode()); String msg = String.format("%s - 执行任务编排调度任务【%s】:未查询到服务节点程序类型数据!--调度结束\r\n", currentDate, taskPlanResourceDTO.getTaskName()); @@ -203,7 +203,7 @@ public class TaskPlanQuartzTaskJob implements BaseTaskJob { ProgramCategoryExecutorInvokerHandler handler = ProgramCategoryExecutorFactory.getHandler(programCategory.toString()); if (Objects.isNull(handler)) { - log.error("未找到对应的服务节点程序类型处理器"); + log.warn("未找到对应的服务节点程序类型处理器"); updateTaskInstanceStatus(taskInstance.getId(), TaskInstanceStatusEnum.SKIP.getCode()); String msg = String.format("%s - 执行任务编排调度任务【%s】:未找到对应的服务节点程序类型处理器!--调度结束\r\n", currentDate, taskPlanResourceDTO.getTaskName()); diff --git a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/utils/HttpUtil.java b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/utils/HttpUtil.java index acc0ec0..449326e 100644 --- a/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/utils/HttpUtil.java +++ b/lanius-orchestrate-server/modules/lanius-orchestrate-serv/src/main/java/org/yzbdl/lanius/orchestrate/serv/utils/HttpUtil.java @@ -19,9 +19,12 @@ import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.yzbdl.lanius.orchestrate.common.exception.runtime.BusinessException; import org.yzbdl.lanius.orchestrate.common.utils.MessageUtil; +import org.yzbdl.lanius.orchestrate.serv.service.resource.impl.ServerProgramServiceImpl; import java.io.*; import java.util.Map; @@ -39,6 +42,9 @@ import javax.servlet.http.HttpServletResponse; */ public class HttpUtil { + private static final Logger log = LoggerFactory.getLogger(HttpUtil.class); + + private static final String CHARACTER_ENCODING = "UTF-8"; private static final String AUTH = "Authorization"; @@ -143,6 +149,7 @@ public class HttpUtil { HttpResponse httpResponse = httpClient.execute(httpGet); int statusCode = httpResponse.getStatusLine().getStatusCode(); if (!Objects.equals(statusCode, HttpStatus.OK.value())){ + log.error("请求:{} 发生错误,http响应状态:{}", url, statusCode); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); } // 拿到响应数据 @@ -160,6 +167,7 @@ public class HttpUtil { base64Str = Base64Encoder.encode(outputStream.toByteArray()); } catch (IOException e) { + log.error("请求:{} 发生IO异常", url, e); throw new BusinessException(MessageUtil.get("task.instance.image_not_found")); }finally { // 执行关闭流操作 -- Gitee