From 69957698fa2190da03995c9250a5eb403d0a0d55 Mon Sep 17 00:00:00 2001 From: ZackYoung Date: Tue, 26 Nov 2024 17:29:33 +0800 Subject: [PATCH 1/2] optimize_no_flink_deps_no_start_dinky --- .../org/dinky/controller/FlinkController.java | 6 ++-- .../org/dinky/controller/TaskController.java | 2 +- .../org/dinky/init/FlinkHistoryServer.java | 2 ++ .../main/java/org/dinky/init/SystemInit.java | 34 ++++++++++++------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java b/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java index f50e2178f2..1273366e43 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java @@ -19,6 +19,7 @@ package org.dinky.controller; +import cn.hutool.core.lang.Singleton; import org.dinky.data.model.CheckPointReadTable; import org.dinky.data.result.Result; import org.dinky.data.vo.CascaderVO; @@ -45,14 +46,13 @@ @SaCheckLogin @RequiredArgsConstructor public class FlinkController { - - protected static final CheckpointRead INSTANCE = new CheckpointRead(); private final FlinkService flinkService; @GetMapping("/readCheckPoint") @ApiOperation("Read Checkpoint") public Result>> readCheckPoint(String path, String operatorId) { - return Result.data(INSTANCE.readCheckpoint(path, operatorId)); + CheckpointRead checkpointRead = Singleton.get(CheckpointRead.class); + return Result.data(checkpointRead.readCheckpoint(path, operatorId)); } @GetMapping("/configOptions") 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 bed837eca8..3f728781eb 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java @@ -313,7 +313,7 @@ public Result flinkJarSqlConvertForm(@RequestBody TaskDTO } Integer lastExecuteJarSqlStatementIndex = null; for (int i = 0; i < statements.length; i++) { - if (ExecuteJarParseStrategyUtil.match(statements[i])) { + if (ExecuteJarParseStrategyUtil.match(statements[i])) { lastExecuteJarSqlStatementIndex = i; } } diff --git a/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java b/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java index 6aaf689bb4..c7a6169a73 100644 --- a/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java +++ b/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java @@ -58,6 +58,8 @@ public class FlinkHistoryServer implements ApplicationRunner { private final SystemConfiguration systemConfiguration = SystemConfiguration.getInstances(); private final SysConfigService sysConfigService; + + public FlinkHistoryServer(JobInstanceService jobInstanceService, SysConfigService sysConfigService) { this.sysConfigService = sysConfigService; this.historyRunnable = () -> { 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 2ac2720263..ebc1d433bc 100644 --- a/dinky-admin/src/main/java/org/dinky/init/SystemInit.java +++ b/dinky-admin/src/main/java/org/dinky/init/SystemInit.java @@ -93,20 +93,28 @@ public class SystemInit implements ApplicationRunner { @Override public void run(ApplicationArguments args) { - TenantContextHolder.ignoreTenant(); - initResources(); - List tenants = tenantService.list(); - sysConfigService.initSysConfig(); - sysConfigService.initExpressionVariables(); - - for (Tenant tenant : tenants) { - taskService.initDefaultFlinkSQLEnv(tenant.getId()); + try { + TenantContextHolder.ignoreTenant(); + initResources(); + List tenants = tenantService.list(); + sysConfigService.initSysConfig(); + sysConfigService.initExpressionVariables(); + + for (Tenant tenant : tenants) { + taskService.initDefaultFlinkSQLEnv(tenant.getId()); + } + initDaemon(); + initDolphinScheduler(); + registerUDF(); + updateGitBuildState(); + registerURL(); + } catch (NoClassDefFoundError e) { + if (e.getMessage().contains("org/apache/flink")){ + log.error("No Flink Jar dependency detected, please put the Flink Jar dependency into the DInky program first. (未检测到有 Flink Jar依赖,请先放入 Flink Jar 依赖到 DInky程序里)",e); + }else { + log.error("",e); + } } - initDaemon(); - initDolphinScheduler(); - registerUDF(); - updateGitBuildState(); - registerURL(); } private void registerURL() { From aaf1bb0941910f184ff94d88f2a34c1befa08b1c Mon Sep 17 00:00:00 2001 From: ZackYoung Date: Tue, 26 Nov 2024 17:55:18 +0800 Subject: [PATCH 2/2] optimize_no_flink_deps_no_start_dinky --- .../java/org/dinky/controller/FlinkController.java | 2 +- .../main/java/org/dinky/controller/TaskController.java | 2 +- .../main/java/org/dinky/init/FlinkHistoryServer.java | 2 -- .../src/main/java/org/dinky/init/SystemInit.java | 10 ++++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java b/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java index 1273366e43..a60b123980 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/FlinkController.java @@ -19,7 +19,6 @@ package org.dinky.controller; -import cn.hutool.core.lang.Singleton; import org.dinky.data.model.CheckPointReadTable; import org.dinky.data.result.Result; import org.dinky.data.vo.CascaderVO; @@ -34,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController; import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.hutool.core.lang.Singleton; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; 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 3f728781eb..bed837eca8 100644 --- a/dinky-admin/src/main/java/org/dinky/controller/TaskController.java +++ b/dinky-admin/src/main/java/org/dinky/controller/TaskController.java @@ -313,7 +313,7 @@ public Result flinkJarSqlConvertForm(@RequestBody TaskDTO } Integer lastExecuteJarSqlStatementIndex = null; for (int i = 0; i < statements.length; i++) { - if (ExecuteJarParseStrategyUtil.match(statements[i])) { + if (ExecuteJarParseStrategyUtil.match(statements[i])) { lastExecuteJarSqlStatementIndex = i; } } diff --git a/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java b/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java index c7a6169a73..6aaf689bb4 100644 --- a/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java +++ b/dinky-admin/src/main/java/org/dinky/init/FlinkHistoryServer.java @@ -58,8 +58,6 @@ public class FlinkHistoryServer implements ApplicationRunner { private final SystemConfiguration systemConfiguration = SystemConfiguration.getInstances(); private final SysConfigService sysConfigService; - - public FlinkHistoryServer(JobInstanceService jobInstanceService, SysConfigService sysConfigService) { this.sysConfigService = sysConfigService; this.historyRunnable = () -> { 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 ebc1d433bc..bc1af97dd4 100644 --- a/dinky-admin/src/main/java/org/dinky/init/SystemInit.java +++ b/dinky-admin/src/main/java/org/dinky/init/SystemInit.java @@ -109,10 +109,12 @@ public void run(ApplicationArguments args) { updateGitBuildState(); registerURL(); } catch (NoClassDefFoundError e) { - if (e.getMessage().contains("org/apache/flink")){ - log.error("No Flink Jar dependency detected, please put the Flink Jar dependency into the DInky program first. (未检测到有 Flink Jar依赖,请先放入 Flink Jar 依赖到 DInky程序里)",e); - }else { - log.error("",e); + if (e.getMessage().contains("org/apache/flink")) { + log.error( + "No Flink Jar dependency detected, please put the Flink Jar dependency into the DInky program first. (未检测到有 Flink Jar依赖,请先放入 Flink Jar 依赖到 DInky程序里)", + e); + } else { + log.error("", e); } } }