Unverified Commit 9fa6d424 authored by gaoyan's avatar gaoyan Committed by GitHub

Fix some bugs (#2443)

* Optimize the process * fix some bugs * fix some bugs
parent 49aca5bc
......@@ -24,6 +24,7 @@ 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.enums.Status;
import org.dinky.data.exception.BusException;
import org.dinky.data.exception.DinkyException;
import org.dinky.data.model.ProcessEntity;
......@@ -75,6 +76,9 @@ public class ConsoleContextHolder {
}
public ProcessEntity getProcess(String processName) {
if (logPross.containsKey(processName)) {
return logPross.get(processName);
}
try {
String filePath = String.format("%s/tmp/log/%s.json", System.getProperty("user.dir"), processName);
String string = FileUtil.readString(filePath, StandardCharsets.UTF_8);
......@@ -120,14 +124,14 @@ public class ConsoleContextHolder {
*/
public void registerProcess(ProcessType type, String processName) throws RuntimeException {
if (logPross.containsKey(processName)) {
throw new BusException("Another user is running an action to suppress this request");
throw new BusException(Status.PROCESS_REGISTER_EXITS);
}
ProcessEntity entity = ProcessEntity.builder()
.key(UUID.fastUUID().toString())
.log(new StringBuilder())
.status(ProcessStatus.INITIALIZING)
.type(type)
.title(processName)
.title(type.getValue())
.startTime(LocalDateTime.now())
.children(new CopyOnWriteArrayList<>())
.build();
......
......@@ -67,13 +67,13 @@ public class SseSessionContextHolder {
log.warn("Session key already exists: {}", sessionKey);
closeSse(sessionKey);
}
SseEmitter sseEmitter = new SseEmitter(60 * 1000L);
SseEmitter sseEmitter = new SseEmitter(60 * 1000L * 10);
sseEmitter.onError(err -> onError(sessionKey, err));
sseEmitter.onTimeout(() -> onTimeout(sessionKey));
sseEmitter.onCompletion(() -> onCompletion(sessionKey));
try {
// Set the client reconnection interval, 0 to reconnect immediately
sseEmitter.send(SseEmitter.event().reconnectTime(0));
sseEmitter.send(SseEmitter.event().reconnectTime(1000));
} catch (IOException e) {
throw new RuntimeException(e);
}
......
......@@ -160,8 +160,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
.url(dsProperties.getUrl())
.username(dsProperties.getUsername())
.password(dsProperties.getPassword())
.dinkyAddr(SystemConfiguration.getInstances().getDinkyAddr().getValue())
.split(SystemConfiguration.getInstances().getSqlSeparator())
.build();
String encodeParam = Base64.getEncoder()
.encodeToString(JsonUtils.toJsonString(appParamConfig).getBytes());
......@@ -179,7 +177,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
&& task.getJobInstanceId() > 0) {
JobInstance jobInstance = jobInstanceService.getById(task.getJobInstanceId());
if (jobInstance != null && !JobStatus.isDone(jobInstance.getStatus())) {
throw new TaskNotDoneException(Status.TASK_STATUS_IS_NOT_DONE.getMessage());
throw new BusException(Status.TASK_STATUS_IS_NOT_DONE.getMessage());
}
}
......
......@@ -67,4 +67,15 @@ public class DBUtil {
}
return sb.toString();
}
public static String getSysConfig(String key) throws SQLException {
Entity option = Entity.create("dinky_sys_config").set("name", key);
List<Entity> entities = db.find(option);
if (entities.size() <= 0) {
throw new IllegalArgumentException(
StrFormatter.format("The system conifg is not found: {}, please check! ", key));
} else {
return entities.get(0).getStr("value");
}
}
}
......@@ -25,6 +25,7 @@ import org.dinky.assertion.Asserts;
import org.dinky.constant.FlinkSQLConstant;
import org.dinky.data.app.AppParamConfig;
import org.dinky.data.app.AppTask;
import org.dinky.data.enums.Status;
import org.dinky.executor.Executor;
import org.dinky.executor.ExecutorConfig;
import org.dinky.executor.ExecutorFactory;
......@@ -89,12 +90,13 @@ public class Submitter {
.build();
// 加载第三方jar //TODO 这里有问题,需要修一修
// String dinkyAddr = Optional.ofNullable(config.getDinkyAddr()).orElse("");
// loadDep(appTask.getType(), config.getTaskId(), dinkyAddr, executorConfig);
// loadDep(appTask.getType(),
// config.getTaskId(),DBUtil.getSysConfig(Status.SYS_ENV_SETTINGS_DINKYADDR.getKey()), executorConfig);
log.info("The job configuration is as follows: {}", executorConfig);
String[] statements = SqlUtil.getStatements(sql, config.getSplit());
String[] statements =
SqlUtil.getStatements(sql, DBUtil.getSysConfig(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR.getKey()));
excuteJob(executorConfig, statements);
}
......
......@@ -24,7 +24,7 @@ import lombok.Data;
/**
* Dinky configuration information passed by the submit Application task
* */
*/
@Data
@Builder
public class AppParamConfig {
......@@ -32,17 +32,14 @@ public class AppParamConfig {
private String url;
private String username;
private String password;
private String dinkyAddr;
private String split;
@Override
public String toString() {
return "\nAppParamConfig{" + "\ntaskId="
+ taskId + "\n, url='"
+ url + '\'' + "\n, username='"
+ username + '\'' + "\n, password='***********'"
+ "\n, dinkyAddr='"
+ dinkyAddr + '\'' + "\n, split='"
+ split + '\'' + "'\n}'";
return "\nAppParamConfig{"
+ "\n taskId=" + taskId
+ "\n, url='" + url + '\''
+ "\n, username='" + username + '\''
+ "\n, password='***********'"
+ "}";
}
}
......@@ -369,6 +369,7 @@ public enum Status {
PROCESS_SUBMIT_BUILDCONFIG(193, "process.submit.buildConfig"),
PROCESS_SUBMIT_EXECUTECOMMSQL(194, "process.submit.execute.commSql"),
PROCESS_SUBMIT_EXECUTEFLINKSQL(195, "process.submit.execute.flinkSql"),
PROCESS_REGISTER_EXITS(196, "process.register.exits"),
;
private final int code;
private final String key;
......
......@@ -237,7 +237,7 @@ sys.resource.settings.hdfs.fs.defaultFS.note=fs.defaultFS configuration items, s
#Dinky Gateway
gateway.kubernetes.test.failed= failed to test the Flink configuration:
task.status.is.not.done=In the current publishing state, a job is running and the online fails, please stop and go online
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.update.failed=Task Update failed
......@@ -248,8 +248,7 @@ process.submit.execute = execute the job
process.submit.buildConfig=Build configuration information
process.submit.execute.commSql=excute commonSql
process.submit.execute.flinkSql=excute flinkSql
process.register.exits=The current task is executing, do not submit it repeatedly, if you have any questions, please go to the configuration center to view
# resource
resource.root.dir.not.allow.delete=The root directory is not allowed to be deleted
resource.dir.or.file.not.exist=The directory or file does not exist
\ No newline at end of file
......@@ -235,7 +235,7 @@ sys.resource.settings.hdfs.fs.defaultFS.note=fs.defaultFS 配置项,例如远
gateway.kubernetes.test.failed=测试 Flink 配置失败:
# Task
task.status.is.not.done=当前发布状态下有作业正在运行,上线失败,请停止后上线
task.status.is.not.done=当前作业状态未停止,请停止后操作
task.sql.explain.failed=sql解析失败,请检查
task.update.failed=Task更新失败
......@@ -246,6 +246,7 @@ process.submit.execute=执行作业
process.submit.buildConfig=构建配置信息
process.submit.execute.commSql=执行普通sql
process.submit.execute.flinkSql=执行flinkSql
process.register.exits=当前任务正在执行,请勿重复提交,如有问题请前往配置中心查看
# resource
resource.root.dir.not.allow.delete=根目录不允许删除
......
......@@ -145,6 +145,7 @@ const ConsoleContent = (props: ConsoleProps) => {
{processNode ? (
<DirectoryTree
className={'treeList'}
style={{height:props.height}}
showIcon={false}
titleRender={renderTitle}
onSelect={onSelect}
......
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