From 4256a3bde874ccaa3c74c3f6fc85cdcddda0fa3e Mon Sep 17 00:00:00 2001 From: gaoyan Date: Wed, 25 Oct 2023 18:16:09 +0800 Subject: [PATCH] [feature][process] Fuck process (#2432) * Optimize the process * Fixed SSE registration failure under certain circumstances * delete process model * change sse log level * add todo * formate code --- .../java/org/dinky/aop/ProcessAspect.java | 14 +-- .../org/dinky/aop/UdfClassLoaderAspect.java | 2 +- .../dinky/context/ConsoleContextHolder.java | 24 +++--- .../context/SseSessionContextHolder.java | 6 +- .../dinky/controller/ProcessController.java | 2 +- .../org/dinky/controller/TaskController.java | 6 +- .../data/exception/SqlExplainExcepition.java | 2 - .../data/exception/TaskNotDoneException.java | 2 - .../main/java/org/dinky/init/SystemInit.java | 2 +- .../java/org/dinky/service/TaskService.java | 2 +- .../impl/ClusterInstanceServiceImpl.java | 1 + .../service/impl/DataBaseServiceImpl.java | 4 +- .../service/impl/GitProjectServiceImpl.java | 2 +- .../service/impl/MonitorServiceImpl.java | 2 +- .../dinky/service/impl/TaskServiceImpl.java | 6 +- .../resource/impl/OssResourceManager.java | 2 +- .../sse/git/AnalysisUdfClassStepSse.java | 2 +- .../sse/git/AnalysisUdfPythonStepSse.java | 2 +- .../dinky/utils/GitProjectStepSseFactory.java | 2 +- .../java/org/dinky/utils/GitRepository.java | 2 +- .../main/java/org/dinky/utils/MavenUtil.java | 2 +- .../data}/annotations/ExecuteProcess.java | 4 +- .../dinky/data}/annotations/ProcessId.java | 2 +- .../dinky/data}/annotations/ProcessStep.java | 4 +- .../org/dinky/data}/enums/ProcessStatus.java | 2 +- .../dinky/data}/enums/ProcessStepType.java | 3 +- .../org/dinky/data}/enums/ProcessType.java | 2 +- .../dinky/data}/exception/DinkyException.java | 2 +- .../data}/exception/ExcuteException.java | 2 +- .../org/dinky/data}/model/ProcessEntity.java | 10 +-- .../dinky/data}/model/ProcessStepEntity.java | 10 +-- .../main/java/org/dinky/job/JobManager.java | 6 +- .../org/dinky/utils/DinkyClassLoaderUtil.java | 2 +- .../dinky/parser/check/AddJarSqlParser.java | 2 +- .../java/org/dinky/function/util/UDFUtil.java | 2 +- .../org/dinky/function/util/UDFUtilTest.java | 2 +- dinky-gateway/pom.xml | 4 - dinky-metadata/dinky-metadata-base/pom.xml | 4 - dinky-metadata/pom.xml | 4 + dinky-process/pom.xml | 85 ------------------- dinky-web/src/models/Sse.tsx | 4 +- pom.xml | 6 -- 42 files changed, 76 insertions(+), 175 deletions(-) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/annotations/ExecuteProcess.java (93%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/annotations/ProcessId.java (96%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/annotations/ProcessStep.java (93%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/enums/ProcessStatus.java (98%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/enums/ProcessStepType.java (96%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/enums/ProcessType.java (98%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/exception/DinkyException.java (97%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/exception/ExcuteException.java (97%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/model/ProcessEntity.java (86%) rename {dinky-process/src/main/java/org/dinky/process => dinky-common/src/main/java/org/dinky/data}/model/ProcessStepEntity.java (86%) delete mode 100644 dinky-process/pom.xml diff --git a/dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java b/dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java index eb2ec05a93..da5cb8aa90 100644 --- a/dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java +++ b/dinky-admin/src/main/java/org/dinky/aop/ProcessAspect.java @@ -20,13 +20,13 @@ package org.dinky.aop; import org.dinky.context.ConsoleContextHolder; -import org.dinky.process.annotations.ExecuteProcess; -import org.dinky.process.annotations.ProcessId; -import org.dinky.process.annotations.ProcessStep; -import org.dinky.process.enums.ProcessStatus; -import org.dinky.process.enums.ProcessStepType; -import org.dinky.process.enums.ProcessType; -import org.dinky.process.model.ProcessStepEntity; +import org.dinky.data.annotations.ExecuteProcess; +import org.dinky.data.annotations.ProcessId; +import org.dinky.data.annotations.ProcessStep; +import org.dinky.data.enums.ProcessStatus; +import org.dinky.data.enums.ProcessStepType; +import org.dinky.data.enums.ProcessType; +import org.dinky.data.model.ProcessStepEntity; import org.apache.http.util.TextUtils; diff --git a/dinky-admin/src/main/java/org/dinky/aop/UdfClassLoaderAspect.java b/dinky-admin/src/main/java/org/dinky/aop/UdfClassLoaderAspect.java index e25640c69c..4ea458bfb4 100644 --- a/dinky-admin/src/main/java/org/dinky/aop/UdfClassLoaderAspect.java +++ b/dinky-admin/src/main/java/org/dinky/aop/UdfClassLoaderAspect.java @@ -21,8 +21,8 @@ import org.dinky.classloader.DinkyClassLoader; import org.dinky.context.DinkyClassLoaderContextHolder; +import org.dinky.data.exception.DinkyException; import org.dinky.job.JobResult; -import org.dinky.process.exception.DinkyException; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; diff --git a/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java b/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java index 1645ad3cbc..1665372d5b 100644 --- a/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java +++ b/dinky-admin/src/main/java/org/dinky/context/ConsoleContextHolder.java @@ -20,14 +20,14 @@ package org.dinky.context; import org.dinky.aop.ProcessAspect; +import org.dinky.data.enums.ProcessStatus; +import org.dinky.data.enums.ProcessStepType; +import org.dinky.data.enums.ProcessType; import org.dinky.data.enums.SseTopic; import org.dinky.data.exception.BusException; -import org.dinky.process.enums.ProcessStatus; -import org.dinky.process.enums.ProcessStepType; -import org.dinky.process.enums.ProcessType; -import org.dinky.process.exception.DinkyException; -import org.dinky.process.model.ProcessEntity; -import org.dinky.process.model.ProcessStepEntity; +import org.dinky.data.exception.DinkyException; +import org.dinky.data.model.ProcessEntity; +import org.dinky.data.model.ProcessStepEntity; import org.dinky.utils.LogUtil; import org.apache.http.util.TextUtils; @@ -36,11 +36,11 @@ import java.time.Duration; import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import org.slf4j.MDC; @@ -129,7 +129,7 @@ public void registerProcess(ProcessType type, String processName) throws Runtime .type(type) .title(processName) .startTime(LocalDateTime.now()) - .children(new LinkedList<>()) + .children(new CopyOnWriteArrayList<>()) .build(); logPross.put(processName, entity); appendLog(processName, null, "Start Process:" + processName); @@ -157,7 +157,7 @@ public ProcessStepEntity registerProcessStep(ProcessStepType type, String proces .type(type) .title(type.getDesc().getMessage()) .log(new StringBuilder()) - .children(new LinkedList<>()) + .children(new CopyOnWriteArrayList<>()) .build(); if (TextUtils.isEmpty(parentStepPid)) { @@ -223,7 +223,7 @@ public void finishedStep(String processName, ProcessStepEntity step, ProcessStat StrFormatter.format("Process Step {} exit with status:{}", step.getType(), status)); } - private ProcessStepEntity getStepNode(String stepPid, LinkedList stepsMap) { + private ProcessStepEntity getStepNode(String stepPid, CopyOnWriteArrayList stepsMap) { ProcessStepEntity stepNode = findStepNode(stepPid, stepsMap); if (stepNode != null) { return stepNode; @@ -240,7 +240,7 @@ private ProcessStepEntity getStepNode(String stepPid, LinkedList stepsMap) { + private ProcessStepEntity findStepNode(String stepPid, CopyOnWriteArrayList stepsMap) { for (ProcessStepEntity processStepEntity : stepsMap) { if (processStepEntity.getKey().equals(stepPid)) { return processStepEntity; @@ -254,7 +254,7 @@ private ProcessStepEntity findStepNode(String stepPid, LinkedList getStepsMap(String processName) { + private CopyOnWriteArrayList getStepsMap(String processName) { return logPross.get(processName).getChildren(); } } diff --git a/dinky-admin/src/main/java/org/dinky/context/SseSessionContextHolder.java b/dinky-admin/src/main/java/org/dinky/context/SseSessionContextHolder.java index 6032ff7c34..0aa68db27e 100644 --- a/dinky-admin/src/main/java/org/dinky/context/SseSessionContextHolder.java +++ b/dinky-admin/src/main/java/org/dinky/context/SseSessionContextHolder.java @@ -62,7 +62,7 @@ public static Set subscribeTopic(String sessionId, List topics) * @return The SseEmitter for the session. */ public static SseEmitter connectSession(String sessionKey) { - log.info("New session wants to connect: {}", sessionKey); + log.debug("New session wants to connect: {}", sessionKey); if (exists(sessionKey)) { log.warn("Session key already exists: {}", sessionKey); closeSse(sessionKey); @@ -97,7 +97,7 @@ public static boolean exists(String sessionKey) { * @param sessionKey The session key of the timed-out session. */ public static void onTimeout(String sessionKey) { - log.info("Type: SseSession Timeout, Session ID: {}", sessionKey); + log.debug("Type: SseSession Timeout, Session ID: {}", sessionKey); closeSse(sessionKey); } @@ -142,7 +142,7 @@ public static void onError(String sessionKey, Throwable throwable) { * @param sessionKey The session key of the completed session. */ public static void onCompletion(String sessionKey) { - log.info("Type: SseSession Completion, Session ID: {}", sessionKey); + log.debug("Type: SseSession Completion, Session ID: {}", sessionKey); closeSse(sessionKey); } diff --git a/dinky-admin/src/main/java/org/dinky/controller/ProcessController.java b/dinky-admin/src/main/java/org/dinky/controller/ProcessController.java index 6dfb6a8019..b5c6d06081 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/ProcessController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/ProcessController.java @@ -20,9 +20,9 @@ package org.dinky.controller; import org.dinky.context.ConsoleContextHolder; +import org.dinky.data.model.ProcessEntity; import org.dinky.data.result.ProTableResult; import org.dinky.data.result.Result; -import org.dinky.process.model.ProcessEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java index 156bb8be93..a5772bd9df 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java @@ -20,10 +20,13 @@ package org.dinky.controller; import org.dinky.data.annotation.Log; +import org.dinky.data.annotations.ExecuteProcess; +import org.dinky.data.annotations.ProcessId; import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.JobLifeCycle; +import org.dinky.data.enums.ProcessType; import org.dinky.data.enums.Status; import org.dinky.data.exception.NotSupportExplainExcepition; import org.dinky.data.model.Task; @@ -33,9 +36,6 @@ import org.dinky.gateway.enums.SavePointType; import org.dinky.gateway.result.SavePointResult; import org.dinky.job.JobResult; -import org.dinky.process.annotations.ExecuteProcess; -import org.dinky.process.annotations.ProcessId; -import org.dinky.process.enums.ProcessType; import org.dinky.service.TaskService; import java.util.List; diff --git a/dinky-admin/src/main/java/org/dinky/data/exception/SqlExplainExcepition.java b/dinky-admin/src/main/java/org/dinky/data/exception/SqlExplainExcepition.java index 4cac0bf9ac..18b028981a 100644 --- a/dinky-admin/src/main/java/org/dinky/data/exception/SqlExplainExcepition.java +++ b/dinky-admin/src/main/java/org/dinky/data/exception/SqlExplainExcepition.java @@ -19,8 +19,6 @@ package org.dinky.data.exception; -import org.dinky.process.exception.ExcuteException; - public class SqlExplainExcepition extends ExcuteException { public SqlExplainExcepition(String message) { super(message); diff --git a/dinky-admin/src/main/java/org/dinky/data/exception/TaskNotDoneException.java b/dinky-admin/src/main/java/org/dinky/data/exception/TaskNotDoneException.java index c680ee6048..4f60d9b817 100644 --- a/dinky-admin/src/main/java/org/dinky/data/exception/TaskNotDoneException.java +++ b/dinky-admin/src/main/java/org/dinky/data/exception/TaskNotDoneException.java @@ -19,8 +19,6 @@ package org.dinky.data.exception; -import org.dinky.process.exception.ExcuteException; - public class TaskNotDoneException extends ExcuteException { public TaskNotDoneException(String message) { super(message); diff --git a/dinky-admin/src/main/java/org/dinky/init/SystemInit.java b/dinky-admin/src/main/java/org/dinky/init/SystemInit.java index 74b4c5e76a..bdfd5310d7 100644 --- a/dinky-admin/src/main/java/org/dinky/init/SystemInit.java +++ b/dinky-admin/src/main/java/org/dinky/init/SystemInit.java @@ -25,6 +25,7 @@ import org.dinky.context.TenantContextHolder; import org.dinky.daemon.task.DaemonFactory; import org.dinky.daemon.task.DaemonTaskConfig; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.JobInstance; import org.dinky.data.model.SystemConfiguration; import org.dinky.data.model.Task; @@ -33,7 +34,6 @@ import org.dinky.function.constant.PathConstant; import org.dinky.function.pool.UdfCodePool; import org.dinky.job.FlinkJobTask; -import org.dinky.process.exception.DinkyException; import org.dinky.scheduler.client.ProjectClient; import org.dinky.scheduler.exception.SchedulerException; import org.dinky.scheduler.model.Project; diff --git a/dinky-admin/src/main/java/org/dinky/service/TaskService.java b/dinky-admin/src/main/java/org/dinky/service/TaskService.java index 2a0b303597..248a673e1f 100644 --- a/dinky-admin/src/main/java/org/dinky/service/TaskService.java +++ b/dinky-admin/src/main/java/org/dinky/service/TaskService.java @@ -23,6 +23,7 @@ import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.enums.JobLifeCycle; +import org.dinky.data.exception.ExcuteException; import org.dinky.data.exception.NotSupportExplainExcepition; import org.dinky.data.model.JobModelOverview; import org.dinky.data.model.JobTypeOverView; @@ -33,7 +34,6 @@ import org.dinky.gateway.result.SavePointResult; import org.dinky.job.JobResult; import org.dinky.mybatis.service.ISuperService; -import org.dinky.process.exception.ExcuteException; import java.util.List; diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java index 2a990e1e0b..0c2401b86b 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/ClusterInstanceServiceImpl.java @@ -68,6 +68,7 @@ public FlinkClusterInfo checkHeartBeat(String hosts, String host) { @Override public String getJobManagerAddress(ClusterInstance clusterInstance) { + // TODO 这里判空逻辑有问题,clusterInstance有可能为null Assert.check(clusterInstance); FlinkClusterInfo info = FlinkCluster.testFlinkJobManagerIP(clusterInstance.getHosts(), clusterInstance.getJobManagerHost()); diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java index f8bd6185c0..506e6d8168 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java @@ -20,9 +20,11 @@ package org.dinky.service.impl; import org.dinky.assertion.Asserts; +import org.dinky.data.annotations.ProcessStep; import org.dinky.data.constant.CommonConstant; import org.dinky.data.dto.SqlDTO; import org.dinky.data.dto.TaskDTO; +import org.dinky.data.enums.ProcessStepType; import org.dinky.data.enums.Status; import org.dinky.data.model.Column; import org.dinky.data.model.DataBase; @@ -36,8 +38,6 @@ import org.dinky.metadata.driver.Driver; import org.dinky.metadata.result.JdbcSelectResult; import org.dinky.mybatis.service.impl.SuperServiceImpl; -import org.dinky.process.annotations.ProcessStep; -import org.dinky.process.enums.ProcessStepType; import org.dinky.service.DataBaseService; import org.apache.commons.lang3.StringUtils; diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java index aa3407ad7d..2670344bae 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java @@ -22,12 +22,12 @@ import org.dinky.data.dto.GitAnalysisJarDTO; import org.dinky.data.dto.GitProjectDTO; import org.dinky.data.dto.TreeNodeDTO; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.GitProject; import org.dinky.data.params.GitProjectSortJarParams; import org.dinky.function.pool.UdfCodePool; import org.dinky.mapper.GitProjectMapper; import org.dinky.mybatis.service.impl.SuperServiceImpl; -import org.dinky.process.exception.DinkyException; import org.dinky.service.GitProjectService; import org.dinky.utils.GitRepository; import org.dinky.utils.TreeUtil; diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/MonitorServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/MonitorServiceImpl.java index ddcbcafc9a..ef3357829a 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/MonitorServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/MonitorServiceImpl.java @@ -20,11 +20,11 @@ package org.dinky.service.impl; import org.dinky.data.dto.MetricsLayoutDTO; +import org.dinky.data.exception.DinkyException; import org.dinky.data.metrics.Jvm; import org.dinky.data.model.Metrics; import org.dinky.data.vo.MetricsVO; import org.dinky.mapper.MetricsMapper; -import org.dinky.process.exception.DinkyException; import org.dinky.service.MonitorService; import org.dinky.utils.PaimonUtil; diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java index 0c6dd06471..e7e992cf11 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java @@ -22,12 +22,14 @@ import org.dinky.assertion.Asserts; import org.dinky.config.Dialect; import org.dinky.context.TenantContextHolder; +import org.dinky.data.annotations.ProcessStep; import org.dinky.data.constant.CommonConstant; import org.dinky.data.dto.AbstractStatementDTO; import org.dinky.data.dto.TaskDTO; import org.dinky.data.dto.TaskRollbackVersionDTO; import org.dinky.data.enums.JobLifeCycle; import org.dinky.data.enums.JobStatus; +import org.dinky.data.enums.ProcessStepType; import org.dinky.data.enums.Status; import org.dinky.data.exception.BusException; import org.dinky.data.exception.NotSupportExplainExcepition; @@ -65,8 +67,6 @@ import org.dinky.job.JobResult; import org.dinky.mapper.TaskMapper; import org.dinky.mybatis.service.impl.SuperServiceImpl; -import org.dinky.process.annotations.ProcessStep; -import org.dinky.process.enums.ProcessStepType; import org.dinky.service.AlertGroupService; import org.dinky.service.CatalogueService; import org.dinky.service.ClusterConfigurationService; @@ -238,7 +238,7 @@ public String buildEnvSql(AbstractStatementDTO task) { task.setVariables(fragmentVariableService.listEnabledVariables()); } int envId = Optional.ofNullable(task.getEnvId()).orElse(-1); - if (envId != -1) { + if (envId >= 0) { TaskDTO envTask = this.getTaskInfoById(task.getEnvId()); if (Asserts.isNotNull(envTask) && Asserts.isNotNullString(envTask.getStatement())) { sql += envTask.getStatement() + CommonConstant.LineSep; diff --git a/dinky-admin/src/main/java/org/dinky/service/resource/impl/OssResourceManager.java b/dinky-admin/src/main/java/org/dinky/service/resource/impl/OssResourceManager.java index cc25fa9063..2e2fe4809e 100644 --- a/dinky-admin/src/main/java/org/dinky/service/resource/impl/OssResourceManager.java +++ b/dinky-admin/src/main/java/org/dinky/service/resource/impl/OssResourceManager.java @@ -20,7 +20,7 @@ package org.dinky.service.resource.impl; import org.dinky.data.exception.BusException; -import org.dinky.process.exception.DinkyException; +import org.dinky.data.exception.DinkyException; import org.dinky.service.resource.BaseResourceManager; import org.dinky.utils.OssTemplate; diff --git a/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfClassStepSse.java b/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfClassStepSse.java index f8b98b9f7f..7887e8b4de 100644 --- a/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfClassStepSse.java +++ b/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfClassStepSse.java @@ -20,9 +20,9 @@ package org.dinky.sse.git; import org.dinky.data.dto.GitAnalysisJarDTO; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.GitProject; import org.dinky.function.util.UDFUtil; -import org.dinky.process.exception.DinkyException; import org.dinky.sse.StepSse; import java.io.File; diff --git a/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfPythonStepSse.java b/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfPythonStepSse.java index 5ddfec42e2..c5d62f1f86 100644 --- a/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfPythonStepSse.java +++ b/dinky-admin/src/main/java/org/dinky/sse/git/AnalysisUdfPythonStepSse.java @@ -20,10 +20,10 @@ package org.dinky.sse.git; import org.dinky.data.dto.GitAnalysisJarDTO; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.GitProject; import org.dinky.data.model.SystemConfiguration; import org.dinky.function.util.UDFUtil; -import org.dinky.process.exception.DinkyException; import org.dinky.sse.StepSse; import java.io.File; diff --git a/dinky-admin/src/main/java/org/dinky/utils/GitProjectStepSseFactory.java b/dinky-admin/src/main/java/org/dinky/utils/GitProjectStepSseFactory.java index 17a64248ef..0129f598e0 100644 --- a/dinky-admin/src/main/java/org/dinky/utils/GitProjectStepSseFactory.java +++ b/dinky-admin/src/main/java/org/dinky/utils/GitProjectStepSseFactory.java @@ -20,9 +20,9 @@ package org.dinky.utils; import org.dinky.context.GitBuildContextHolder; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.GitProject; import org.dinky.data.result.StepResult; -import org.dinky.process.exception.DinkyException; import org.dinky.sse.DoneStepSse; import org.dinky.sse.StepSse; import org.dinky.sse.git.AnalysisUdfClassStepSse; diff --git a/dinky-admin/src/main/java/org/dinky/utils/GitRepository.java b/dinky-admin/src/main/java/org/dinky/utils/GitRepository.java index c3ab7fbd97..15d7eec489 100644 --- a/dinky-admin/src/main/java/org/dinky/utils/GitRepository.java +++ b/dinky-admin/src/main/java/org/dinky/utils/GitRepository.java @@ -20,8 +20,8 @@ package org.dinky.utils; import org.dinky.data.dto.GitProjectDTO; +import org.dinky.data.exception.DinkyException; import org.dinky.function.constant.PathConstant; -import org.dinky.process.exception.DinkyException; import java.io.File; import java.io.StringWriter; diff --git a/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java b/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java index 831df5be25..c54148339f 100644 --- a/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java +++ b/dinky-admin/src/main/java/org/dinky/utils/MavenUtil.java @@ -19,9 +19,9 @@ package org.dinky.utils; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.SystemConfiguration; import org.dinky.function.constant.PathConstant; -import org.dinky.process.exception.DinkyException; import java.io.File; import java.io.IOException; diff --git a/dinky-process/src/main/java/org/dinky/process/annotations/ExecuteProcess.java b/dinky-common/src/main/java/org/dinky/data/annotations/ExecuteProcess.java similarity index 93% rename from dinky-process/src/main/java/org/dinky/process/annotations/ExecuteProcess.java rename to dinky-common/src/main/java/org/dinky/data/annotations/ExecuteProcess.java index 7917a6cd45..4e83343d66 100644 --- a/dinky-process/src/main/java/org/dinky/process/annotations/ExecuteProcess.java +++ b/dinky-common/src/main/java/org/dinky/data/annotations/ExecuteProcess.java @@ -17,9 +17,9 @@ * */ -package org.dinky.process.annotations; +package org.dinky.data.annotations; -import org.dinky.process.enums.ProcessType; +import org.dinky.data.enums.ProcessType; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; diff --git a/dinky-process/src/main/java/org/dinky/process/annotations/ProcessId.java b/dinky-common/src/main/java/org/dinky/data/annotations/ProcessId.java similarity index 96% rename from dinky-process/src/main/java/org/dinky/process/annotations/ProcessId.java rename to dinky-common/src/main/java/org/dinky/data/annotations/ProcessId.java index d4a12657e0..a7d67eaf53 100644 --- a/dinky-process/src/main/java/org/dinky/process/annotations/ProcessId.java +++ b/dinky-common/src/main/java/org/dinky/data/annotations/ProcessId.java @@ -17,7 +17,7 @@ * */ -package org.dinky.process.annotations; +package org.dinky.data.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; diff --git a/dinky-process/src/main/java/org/dinky/process/annotations/ProcessStep.java b/dinky-common/src/main/java/org/dinky/data/annotations/ProcessStep.java similarity index 93% rename from dinky-process/src/main/java/org/dinky/process/annotations/ProcessStep.java rename to dinky-common/src/main/java/org/dinky/data/annotations/ProcessStep.java index 61130110c8..742283b359 100644 --- a/dinky-process/src/main/java/org/dinky/process/annotations/ProcessStep.java +++ b/dinky-common/src/main/java/org/dinky/data/annotations/ProcessStep.java @@ -17,9 +17,9 @@ * */ -package org.dinky.process.annotations; +package org.dinky.data.annotations; -import org.dinky.process.enums.ProcessStepType; +import org.dinky.data.enums.ProcessStepType; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; diff --git a/dinky-process/src/main/java/org/dinky/process/enums/ProcessStatus.java b/dinky-common/src/main/java/org/dinky/data/enums/ProcessStatus.java similarity index 98% rename from dinky-process/src/main/java/org/dinky/process/enums/ProcessStatus.java rename to dinky-common/src/main/java/org/dinky/data/enums/ProcessStatus.java index 222a3a8a46..fbc34dd2e1 100644 --- a/dinky-process/src/main/java/org/dinky/process/enums/ProcessStatus.java +++ b/dinky-common/src/main/java/org/dinky/data/enums/ProcessStatus.java @@ -17,7 +17,7 @@ * */ -package org.dinky.process.enums; +package org.dinky.data.enums; import org.dinky.assertion.Asserts; diff --git a/dinky-process/src/main/java/org/dinky/process/enums/ProcessStepType.java b/dinky-common/src/main/java/org/dinky/data/enums/ProcessStepType.java similarity index 96% rename from dinky-process/src/main/java/org/dinky/process/enums/ProcessStepType.java rename to dinky-common/src/main/java/org/dinky/data/enums/ProcessStepType.java index 6ebc0ef296..1738ebca78 100644 --- a/dinky-process/src/main/java/org/dinky/process/enums/ProcessStepType.java +++ b/dinky-common/src/main/java/org/dinky/data/enums/ProcessStepType.java @@ -17,10 +17,9 @@ * */ -package org.dinky.process.enums; +package org.dinky.data.enums; import org.dinky.assertion.Asserts; -import org.dinky.data.enums.Status; import lombok.Getter; diff --git a/dinky-process/src/main/java/org/dinky/process/enums/ProcessType.java b/dinky-common/src/main/java/org/dinky/data/enums/ProcessType.java similarity index 98% rename from dinky-process/src/main/java/org/dinky/process/enums/ProcessType.java rename to dinky-common/src/main/java/org/dinky/data/enums/ProcessType.java index a1f207dba0..6c1859fd77 100644 --- a/dinky-process/src/main/java/org/dinky/process/enums/ProcessType.java +++ b/dinky-common/src/main/java/org/dinky/data/enums/ProcessType.java @@ -17,7 +17,7 @@ * */ -package org.dinky.process.enums; +package org.dinky.data.enums; import org.dinky.assertion.Asserts; diff --git a/dinky-process/src/main/java/org/dinky/process/exception/DinkyException.java b/dinky-common/src/main/java/org/dinky/data/exception/DinkyException.java similarity index 97% rename from dinky-process/src/main/java/org/dinky/process/exception/DinkyException.java rename to dinky-common/src/main/java/org/dinky/data/exception/DinkyException.java index 3d4f317dcd..d46d0c9c50 100644 --- a/dinky-process/src/main/java/org/dinky/process/exception/DinkyException.java +++ b/dinky-common/src/main/java/org/dinky/data/exception/DinkyException.java @@ -17,7 +17,7 @@ * */ -package org.dinky.process.exception; +package org.dinky.data.exception; /** @since 0.7.0 */ public class DinkyException extends RuntimeException { diff --git a/dinky-process/src/main/java/org/dinky/process/exception/ExcuteException.java b/dinky-common/src/main/java/org/dinky/data/exception/ExcuteException.java similarity index 97% rename from dinky-process/src/main/java/org/dinky/process/exception/ExcuteException.java rename to dinky-common/src/main/java/org/dinky/data/exception/ExcuteException.java index 3c3cf7c056..d0c0154087 100644 --- a/dinky-process/src/main/java/org/dinky/process/exception/ExcuteException.java +++ b/dinky-common/src/main/java/org/dinky/data/exception/ExcuteException.java @@ -17,7 +17,7 @@ * */ -package org.dinky.process.exception; +package org.dinky.data.exception; public class ExcuteException extends Exception { diff --git a/dinky-process/src/main/java/org/dinky/process/model/ProcessEntity.java b/dinky-common/src/main/java/org/dinky/data/model/ProcessEntity.java similarity index 86% rename from dinky-process/src/main/java/org/dinky/process/model/ProcessEntity.java rename to dinky-common/src/main/java/org/dinky/data/model/ProcessEntity.java index 8f3349294e..b6654b04bb 100644 --- a/dinky-process/src/main/java/org/dinky/process/model/ProcessEntity.java +++ b/dinky-common/src/main/java/org/dinky/data/model/ProcessEntity.java @@ -17,14 +17,14 @@ * */ -package org.dinky.process.model; +package org.dinky.data.model; import org.dinky.data.constant.CommonConstant; -import org.dinky.process.enums.ProcessStatus; -import org.dinky.process.enums.ProcessType; +import org.dinky.data.enums.ProcessStatus; +import org.dinky.data.enums.ProcessType; import java.time.LocalDateTime; -import java.util.LinkedList; +import java.util.concurrent.CopyOnWriteArrayList; import lombok.AllArgsConstructor; import lombok.Builder; @@ -49,7 +49,7 @@ public class ProcessEntity { private LocalDateTime endTime; private long time; private ProcessStepEntity lastUpdateStep; - private LinkedList children; + private CopyOnWriteArrayList children; public void appendLog(String str) { log.append(str).append(CommonConstant.LineSep); diff --git a/dinky-process/src/main/java/org/dinky/process/model/ProcessStepEntity.java b/dinky-common/src/main/java/org/dinky/data/model/ProcessStepEntity.java similarity index 86% rename from dinky-process/src/main/java/org/dinky/process/model/ProcessStepEntity.java rename to dinky-common/src/main/java/org/dinky/data/model/ProcessStepEntity.java index 96538ee590..a360bd51c1 100644 --- a/dinky-process/src/main/java/org/dinky/process/model/ProcessStepEntity.java +++ b/dinky-common/src/main/java/org/dinky/data/model/ProcessStepEntity.java @@ -17,14 +17,14 @@ * */ -package org.dinky.process.model; +package org.dinky.data.model; import org.dinky.data.constant.CommonConstant; -import org.dinky.process.enums.ProcessStatus; -import org.dinky.process.enums.ProcessStepType; +import org.dinky.data.enums.ProcessStatus; +import org.dinky.data.enums.ProcessStepType; import java.time.LocalDateTime; -import java.util.LinkedList; +import java.util.concurrent.CopyOnWriteArrayList; import lombok.AllArgsConstructor; import lombok.Builder; @@ -49,7 +49,7 @@ public class ProcessStepEntity { private LocalDateTime endTime; private long time; private StringBuilder log = new StringBuilder(); - private LinkedList children; + private CopyOnWriteArrayList children; public void appendLog(String str) { log.append(str).append(CommonConstant.LineSep); diff --git a/dinky-core/src/main/java/org/dinky/job/JobManager.java b/dinky-core/src/main/java/org/dinky/job/JobManager.java index ff8ca35144..ef72e208c7 100644 --- a/dinky-core/src/main/java/org/dinky/job/JobManager.java +++ b/dinky-core/src/main/java/org/dinky/job/JobManager.java @@ -29,6 +29,9 @@ import org.dinky.context.CustomTableEnvironmentContext; import org.dinky.context.FlinkUdfPathContextHolder; import org.dinky.context.RowLevelPermissionsContext; +import org.dinky.data.annotations.ProcessStep; +import org.dinky.data.enums.ProcessStepType; +import org.dinky.data.exception.DinkyException; import org.dinky.data.model.FlinkUdfManifest; import org.dinky.data.model.SystemConfiguration; import org.dinky.data.result.ErrorResult; @@ -58,9 +61,6 @@ import org.dinky.interceptor.FlinkInterceptorResult; import org.dinky.parser.SqlType; import org.dinky.parser.check.AddJarSqlParser; -import org.dinky.process.annotations.ProcessStep; -import org.dinky.process.enums.ProcessStepType; -import org.dinky.process.exception.DinkyException; import org.dinky.trans.ExecuteJarParseStrategy; import org.dinky.trans.Operations; import org.dinky.trans.dml.ExecuteJarOperation; diff --git a/dinky-core/src/main/java/org/dinky/utils/DinkyClassLoaderUtil.java b/dinky-core/src/main/java/org/dinky/utils/DinkyClassLoaderUtil.java index 84f09ec925..f32f9dc6c2 100644 --- a/dinky-core/src/main/java/org/dinky/utils/DinkyClassLoaderUtil.java +++ b/dinky-core/src/main/java/org/dinky/utils/DinkyClassLoaderUtil.java @@ -22,8 +22,8 @@ import org.dinky.assertion.Asserts; import org.dinky.context.DinkyClassLoaderContextHolder; import org.dinky.context.FlinkUdfPathContextHolder; +import org.dinky.data.exception.DinkyException; import org.dinky.job.JobConfig; -import org.dinky.process.exception.DinkyException; import org.apache.flink.configuration.PipelineOptions; diff --git a/dinky-executor/src/main/java/org/dinky/parser/check/AddJarSqlParser.java b/dinky-executor/src/main/java/org/dinky/parser/check/AddJarSqlParser.java index b6a7ad0b9a..2044cda9a1 100644 --- a/dinky-executor/src/main/java/org/dinky/parser/check/AddJarSqlParser.java +++ b/dinky-executor/src/main/java/org/dinky/parser/check/AddJarSqlParser.java @@ -19,7 +19,7 @@ package org.dinky.parser.check; -import org.dinky.process.exception.DinkyException; +import org.dinky.data.exception.DinkyException; import org.dinky.utils.URLUtils; import java.io.File; diff --git a/dinky-function/src/main/java/org/dinky/function/util/UDFUtil.java b/dinky-function/src/main/java/org/dinky/function/util/UDFUtil.java index bcff1987a3..abf3dab15f 100644 --- a/dinky-function/src/main/java/org/dinky/function/util/UDFUtil.java +++ b/dinky-function/src/main/java/org/dinky/function/util/UDFUtil.java @@ -23,6 +23,7 @@ import org.dinky.config.Dialect; import org.dinky.context.DinkyClassLoaderContextHolder; import org.dinky.context.FlinkUdfPathContextHolder; +import org.dinky.data.exception.DinkyException; import org.dinky.function.FunctionFactory; import org.dinky.function.compiler.CustomStringJavaCompiler; import org.dinky.function.compiler.CustomStringScalaCompiler; @@ -32,7 +33,6 @@ import org.dinky.gateway.enums.GatewayType; import org.dinky.pool.ClassEntity; import org.dinky.pool.ClassPool; -import org.dinky.process.exception.DinkyException; import org.apache.flink.client.python.PythonFunctionFactory; import org.apache.flink.configuration.Configuration; diff --git a/dinky-function/src/test/java/org/dinky/function/util/UDFUtilTest.java b/dinky-function/src/test/java/org/dinky/function/util/UDFUtilTest.java index 362e57f75a..5255d06cb5 100644 --- a/dinky-function/src/test/java/org/dinky/function/util/UDFUtilTest.java +++ b/dinky-function/src/test/java/org/dinky/function/util/UDFUtilTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.dinky.process.exception.DinkyException; +import org.dinky.data.exception.DinkyException; import java.io.IOException; import java.io.InputStreamReader; diff --git a/dinky-gateway/pom.xml b/dinky-gateway/pom.xml index db983956ff..3831c1cc71 100644 --- a/dinky-gateway/pom.xml +++ b/dinky-gateway/pom.xml @@ -45,10 +45,6 @@ dinky-client-hadoop ${scope.runtime} - - org.dinky - dinky-process - org.dinky dinky-client-${dinky.flink.version} diff --git a/dinky-metadata/dinky-metadata-base/pom.xml b/dinky-metadata/dinky-metadata-base/pom.xml index 417ec97067..438b9d751b 100644 --- a/dinky-metadata/dinky-metadata-base/pom.xml +++ b/dinky-metadata/dinky-metadata-base/pom.xml @@ -31,10 +31,6 @@ Dinky : Metadata : Base - - org.dinky - dinky-process - com.alibaba druid-spring-boot-starter diff --git a/dinky-metadata/pom.xml b/dinky-metadata/pom.xml index e798b9ae97..63b948c0fe 100644 --- a/dinky-metadata/pom.xml +++ b/dinky-metadata/pom.xml @@ -49,6 +49,10 @@ com.github.xiaoymin knife4j-openapi2-spring-boot-starter + + org.dinky + dinky-common + diff --git a/dinky-process/pom.xml b/dinky-process/pom.xml deleted file mode 100644 index c69d5453a9..0000000000 --- a/dinky-process/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - org.dinky - dinky - ${revision} - ../pom.xml - - dinky-process - - jar - - Dinky : Process - - - - org.dinky - dinky-common - - - - org.junit.vintage - junit-vintage-engine - test - - - org.assertj - assertj-core - test - - - org.mockito - mockito-core - jar - test - - - org.powermock - powermock-module-junit4 - jar - test - - - org.powermock - powermock-api-mockito2 - jar - test - - - org.mockito - mockito-core - - - - - org.hamcrest - hamcrest-all - jar - test - - - org.testcontainers - junit-jupiter - test - - - diff --git a/dinky-web/src/models/Sse.tsx b/dinky-web/src/models/Sse.tsx index 30886f4f17..ede6f726b1 100644 --- a/dinky-web/src/models/Sse.tsx +++ b/dinky-web/src/models/Sse.tsx @@ -39,7 +39,7 @@ export default () => { const topics: string[] = []; subscriberRef.current.forEach((sub) => topics.push(...sub.topic)); const para = { sessionKey: uuidRef.current, topics: topics }; - await postAll('api/sse/subscribeTopic', para); + await postAll('api/sse/subscribeTopic', para).catch(e=>ErrorMessage(e)) }; const reconnectSse = () => { @@ -54,7 +54,7 @@ export default () => { useEffect(() => { if (eventSource) { - eventSource.onopen = () => subscribe(); + eventSource.onopen = () => setTimeout(()=>subscribe(),1000); eventSource.onmessage = (e) => { try { const data: SseData = JSON.parse(e.data); diff --git a/pom.xml b/pom.xml index 8d24a71bfe..c11a391f82 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,6 @@ dinky-client dinky-cdc dinky-catalog - dinky-process dinky-gateway dinky-function dinky-metadata @@ -643,11 +642,6 @@ dinky-scheduler ${project.version} - - org.dinky - dinky-process - ${project.version} - javax.xml.bind jaxb-api