Unverified Commit 6b8d51b5 authored by gaoyan's avatar gaoyan Committed by GitHub

[Fix]Fixed the JAR task could not use set (#3057)

parent ed1e6951
...@@ -22,7 +22,6 @@ package org.dinky.aop.exception; ...@@ -22,7 +22,6 @@ package org.dinky.aop.exception;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import org.dinky.data.exception.BusException; import org.dinky.data.exception.BusException;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.utils.I18n;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -47,7 +46,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -47,7 +46,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.exception.NotLoginException;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -64,9 +62,6 @@ public class WebExceptionHandler { ...@@ -64,9 +62,6 @@ public class WebExceptionHandler {
@ResponseBody @ResponseBody
public Result<Void> busException(BusException e) { public Result<Void> busException(BusException e) {
log.error("BusException:", e); log.error("BusException:", e);
if (StrUtil.isEmpty(e.getMsg())) {
return Result.failed(I18n.getMessage(e.getCode(), e.getMessage()));
}
return Result.failed(e.getMsg()); return Result.failed(e.getMsg());
} }
......
...@@ -21,7 +21,6 @@ package org.dinky.data.exception; ...@@ -21,7 +21,6 @@ package org.dinky.data.exception;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
...@@ -43,14 +42,14 @@ public class BusException extends RuntimeException { ...@@ -43,14 +42,14 @@ public class BusException extends RuntimeException {
private static final long serialVersionUID = -2955156471454043812L; private static final long serialVersionUID = -2955156471454043812L;
/** 异常信息的code码 */ /** 异常信息的code码 */
private String code; private Status code;
/** 如果有值得话,将不会取i18n里面的错误信息 */
private String msg;
/** 异常信息的参数 */ /** 异常信息的参数 */
private Object[] errorArgs; private Object[] errorArgs;
/** 如果有值得话,将不会取i18n里面的错误信息 */
private String msg;
public BusException(String message) { public BusException(String message) {
super(message); super(message);
setMsg(message); setMsg(message);
...@@ -58,32 +57,30 @@ public class BusException extends RuntimeException { ...@@ -58,32 +57,30 @@ public class BusException extends RuntimeException {
public BusException(Status status) { public BusException(Status status) {
super(status.getMessage()); super(status.getMessage());
setCode(String.valueOf(status.getCode())); setCode(status);
setMsg(status.getMessage()); setMsg(status.getMessage());
} }
public BusException(Status status, Object... errorArgs) { public BusException(Status status, Object... errorArgs) {
super(status.getMessage()); super(status.getMessage());
setCode(String.valueOf(status.getCode())); setCode(status);
setMsg(StrUtil.format(status.getMessage(), errorArgs)); setMsg(StrUtil.format(status.getMessage(), errorArgs));
} }
public BusException(String message, Object... args) {
super();
setCode(message);
setErrorArgs(args);
}
/** /**
* An exception that gets the error message through i 18n * An exception that gets the error message through i 18n
* *
* @param code code * @param message code
* @param e e * @param e e
* @return {@link BusException} * @return {@link BusException}
*/ */
public static BusException valueOf(String code, Throwable e) { public static BusException valueOf(String message, Throwable e) {
String errMsg = ExceptionUtil.stacktraceToString(e); log.error(message, e);
log.error(errMsg); return new BusException(message + e.getMessage());
}
public static BusException valueOf(Status code, Throwable e) {
log.error(code.getMessage(), e);
return new BusException(code, e.getMessage()); return new BusException(code, e.getMessage());
} }
...@@ -94,7 +91,7 @@ public class BusException extends RuntimeException { ...@@ -94,7 +91,7 @@ public class BusException extends RuntimeException {
* @param errorArgs errorArgs * @param errorArgs errorArgs
* @return {@link BusException} * @return {@link BusException}
*/ */
public static BusException valueOf(String code, Object... errorArgs) { public static BusException valueOf(Status code, Object... errorArgs) {
return new BusException(code, errorArgs); return new BusException(code, errorArgs);
} }
...@@ -104,7 +101,7 @@ public class BusException extends RuntimeException { ...@@ -104,7 +101,7 @@ public class BusException extends RuntimeException {
* @param msg msg * @param msg msg
* @return {@link BusException} * @return {@link BusException}
*/ */
public static BusException valueOfMsg(String msg) { public static BusException valueOf(String msg) {
return new BusException(msg); return new BusException(msg);
} }
} }
...@@ -65,6 +65,7 @@ import org.dinky.utils.LogUtil; ...@@ -65,6 +65,7 @@ import org.dinky.utils.LogUtil;
import org.dinky.utils.SqlUtil; import org.dinky.utils.SqlUtil;
import org.dinky.utils.URLUtils; import org.dinky.utils.URLUtils;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.CoreOptions; import org.apache.flink.configuration.CoreOptions;
import org.apache.flink.configuration.DeploymentOptions; import org.apache.flink.configuration.DeploymentOptions;
import org.apache.flink.configuration.PipelineOptions; import org.apache.flink.configuration.PipelineOptions;
...@@ -256,12 +257,12 @@ public class JobManager { ...@@ -256,12 +257,12 @@ public class JobManager {
ready(); ready();
JobJarStreamGraphBuilder jobJarStreamGraphBuilder = JobJarStreamGraphBuilder.build(this); JobJarStreamGraphBuilder jobJarStreamGraphBuilder = JobJarStreamGraphBuilder.build(this);
StreamGraph streamGraph = jobJarStreamGraphBuilder.getJarStreamGraph(statement, getDinkyClassLoader()); StreamGraph streamGraph = jobJarStreamGraphBuilder.getJarStreamGraph(statement, getDinkyClassLoader());
Configuration configuration =
executor.getCustomTableEnvironment().getConfig().getConfiguration();
if (Asserts.isNotNullString(config.getSavePointPath())) { if (Asserts.isNotNullString(config.getSavePointPath())) {
streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath( streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(
config.getSavePointPath(), config.getSavePointPath(),
executor.getStreamExecutionEnvironment() configuration.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
.getConfiguration()
.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
} }
try { try {
if (!useGateway) { if (!useGateway) {
...@@ -282,7 +283,7 @@ public class JobManager { ...@@ -282,7 +283,7 @@ public class JobManager {
} }
} else { } else {
GatewayResult gatewayResult; GatewayResult gatewayResult;
config.addGatewayConfig(executor.getSetConfig()); config.addGatewayConfig(configuration);
if (runMode.isApplicationMode()) { if (runMode.isApplicationMode()) {
gatewayResult = Gateway.build(config.getGatewayConfig()).submitJar(getUdfPathContextHolder()); gatewayResult = Gateway.build(config.getGatewayConfig()).submitJar(getUdfPathContextHolder());
} else { } else {
......
...@@ -170,6 +170,8 @@ EXECUTE JAR WITH ( ...@@ -170,6 +170,8 @@ EXECUTE JAR WITH (
**样例代码** **样例代码**
```sql ```sql
set 'execution.checkpointing.interval'='21 s';
EXECUTE JAR WITH ( EXECUTE JAR WITH (
'uri'='rs:/jar/flink/demo/SocketWindowWordCount.jar', 'uri'='rs:/jar/flink/demo/SocketWindowWordCount.jar',
'main-class'='org.apache.flink.streaming.examples.socket', 'main-class'='org.apache.flink.streaming.examples.socket',
......
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