Unverified Commit 24887a23 authored by 173lyb's avatar 173lyb Committed by GitHub

[Improvement] Optimize selection prompt information when querying in yarn…

[Improvement] Optimize selection prompt information when querying in yarn application mode; Added Run button to check select execute (#3260) Co-authored-by: 's avatar173lyb <1733829298@qq.com>
parent 13214ce0
...@@ -335,6 +335,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -335,6 +335,11 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
task.setUseResult(true); task.setUseResult(true);
// Debug mode need execute // Debug mode need execute
task.setStatementSet(false); task.setStatementSet(false);
// mode check
if (GatewayType.get(task.getType()).isDeployCluster()) {
throw new BusException(Status.MODE_IS_NOT_ALLOW_SELECT.getMessage());
}
// 注解自调用会失效,这里通过获取对象方法绕过此限制 // 注解自调用会失效,这里通过获取对象方法绕过此限制
TaskServiceImpl taskServiceBean = applicationContext.getBean(TaskServiceImpl.class); TaskServiceImpl taskServiceBean = applicationContext.getBean(TaskServiceImpl.class);
JobResult jobResult; JobResult jobResult;
......
...@@ -189,6 +189,8 @@ public enum Status { ...@@ -189,6 +189,8 @@ public enum Status {
TASK_IS_PUBLISH_CANNOT_DELETE(12011, "task.is.publish.cannot.delete"), TASK_IS_PUBLISH_CANNOT_DELETE(12011, "task.is.publish.cannot.delete"),
TASK_IS_RUNNING_CANNOT_DELETE(12012, "task.is.running.cannot.delete"), TASK_IS_RUNNING_CANNOT_DELETE(12012, "task.is.running.cannot.delete"),
JOB_ALERT_MAX_SEND_COUNT(12013, "job.alert.max.send.count"), JOB_ALERT_MAX_SEND_COUNT(12013, "job.alert.max.send.count"),
MODE_IS_NOT_ALLOW_SELECT(12014, "mode.is.not.allow.select"),
OPERATE_NOT_SUPPORT_QUERY(12015, "operate.not.support.query"),
/** /**
* alert instance * alert instance
...@@ -347,7 +349,6 @@ public enum Status { ...@@ -347,7 +349,6 @@ public enum Status {
SYS_ENV_SETTINGS_DIFF_MINUTE_MAX_SEND_COUNT(120, "sys.env.settings.diffMinuteMaxSendCount"), SYS_ENV_SETTINGS_DIFF_MINUTE_MAX_SEND_COUNT(120, "sys.env.settings.diffMinuteMaxSendCount"),
SYS_ENV_SETTINGS_DIFF_MINUTE_MAX_SEND_COUNT_NOTE(121, "sys.env.settings.diffMinuteMaxSendCount.note"), SYS_ENV_SETTINGS_DIFF_MINUTE_MAX_SEND_COUNT_NOTE(121, "sys.env.settings.diffMinuteMaxSendCount.note"),
SYS_ENV_SETTINGS_MAX_RETAIN_DAYS(1171, "sys.env.settings.maxRetainDays"), SYS_ENV_SETTINGS_MAX_RETAIN_DAYS(1171, "sys.env.settings.maxRetainDays"),
SYS_ENV_SETTINGS_MAX_RETAIN_DAYS_NOTE(1172, "sys.env.settings.maxRetainDays.note"), SYS_ENV_SETTINGS_MAX_RETAIN_DAYS_NOTE(1172, "sys.env.settings.maxRetainDays.note"),
SYS_ENV_SETTINGS_MAX_RETAIN_COUNT(1173, "sys.env.settings.maxRetainCount"), SYS_ENV_SETTINGS_MAX_RETAIN_COUNT(1173, "sys.env.settings.maxRetainCount"),
......
...@@ -275,6 +275,8 @@ gateway.kubernetes.test.failed= failed to test the Flink configuration: ...@@ -275,6 +275,8 @@ gateway.kubernetes.test.failed= failed to test the Flink configuration:
task.status.is.not.done=The current job status is not stopped, please stop after operation task.status.is.not.done=The current job status is not stopped, please stop after operation
task.sql.explain.failed=SQL parsing failed, please check the SQL statement task.sql.explain.failed=SQL parsing failed, please check the SQL statement
task.update.failed=Task Update failed task.update.failed=Task Update failed
mode.is.not.allow.select=Application / Pre-Job mode does not allow executing select statements. To perform this operation, please switch to Local, Standalone, or Yarn session modes.
operate.not.support.query=The [Run] button does not support select statements, please switch to the [Query] button.
# process # process
process.submit.submitTask= Submit the job process.submit.submitTask= Submit the job
......
...@@ -275,6 +275,8 @@ gateway.kubernetes.test.failed=测试 Flink 配置失败: ...@@ -275,6 +275,8 @@ gateway.kubernetes.test.failed=测试 Flink 配置失败:
task.status.is.not.done=当前作业状态未停止,请停止后操作 task.status.is.not.done=当前作业状态未停止,请停止后操作
task.sql.explain.failed=sql解析失败,请检查 task.sql.explain.failed=sql解析失败,请检查
task.update.failed=Task更新失败 task.update.failed=Task更新失败
mode.is.not.allow.select=Application / Pre-Job 模式不允许执行 select 语句, 如需执行此操作, 请切换至 Local、Standalone、Yarn session等模式
operate.not.support.query=[运行] 按钮不支持 select 语句,请切换至 [查询] 按钮
# process # process
process.submit.submitTask=提交作业 process.submit.submitTask=提交作业
......
...@@ -28,6 +28,7 @@ import org.dinky.context.RowLevelPermissionsContext; ...@@ -28,6 +28,7 @@ import org.dinky.context.RowLevelPermissionsContext;
import org.dinky.data.annotations.ProcessStep; import org.dinky.data.annotations.ProcessStep;
import org.dinky.data.enums.GatewayType; import org.dinky.data.enums.GatewayType;
import org.dinky.data.enums.ProcessStepType; import org.dinky.data.enums.ProcessStepType;
import org.dinky.data.enums.Status;
import org.dinky.data.exception.BusException; import org.dinky.data.exception.BusException;
import org.dinky.data.model.SystemConfiguration; import org.dinky.data.model.SystemConfiguration;
import org.dinky.data.result.ErrorResult; import org.dinky.data.result.ErrorResult;
...@@ -108,7 +109,6 @@ public class JobManager { ...@@ -108,7 +109,6 @@ public class JobManager {
private boolean useStatementSet = false; private boolean useStatementSet = false;
private boolean useRestAPI = false; private boolean useRestAPI = false;
private GatewayType runMode = GatewayType.LOCAL; private GatewayType runMode = GatewayType.LOCAL;
private JobParam jobParam = null; private JobParam jobParam = null;
private String currentSql = ""; private String currentSql = "";
private final WeakReference<DinkyClassLoader> dinkyClassLoader = new WeakReference<>(DinkyClassLoader.build()); private final WeakReference<DinkyClassLoader> dinkyClassLoader = new WeakReference<>(DinkyClassLoader.build());
...@@ -350,8 +350,12 @@ public class JobManager { ...@@ -350,8 +350,12 @@ public class JobManager {
success(); success();
} }
} catch (Exception e) { } catch (Exception e) {
String errorMessage = e.getMessage();
if (errorMessage.contains("Only insert statement is supported now")) {
throw new BusException(Status.OPERATE_NOT_SUPPORT_QUERY.getMessage());
}
String error = StrFormatter.format( String error = StrFormatter.format(
"Exception in executing FlinkSQL:\n{}\n{}", SqlUtil.addLineNumber(currentSql), e.getMessage()); "Exception in executing FlinkSQL:\n{}\n{}", SqlUtil.addLineNumber(currentSql), errorMessage);
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.FAILED); job.setStatus(Job.JobStatus.FAILED);
job.setError(error); job.setError(error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment