This is an automated email from the ASF dual-hosted git repository.
leonbao pushed a commit to branch json_split_two
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/json_split_two by this push:
new f6ba944 [Feature][JsonSplit-api] fix some bug in joint commissioning
(#6096)
f6ba944 is described below
commit f6ba9442b9bfeace0bc6160fa3ec1741bcf4ab2c
Author: JinyLeeChina <[email protected]>
AuthorDate: Fri Sep 3 15:30:31 2021 +0800
[Feature][JsonSplit-api] fix some bug in joint commissioning (#6096)
* refactor method of task save
* fix ut
* fix ut
* update method of processDefinition
* fix ut
* fix some bug in joint commissioning
* reomve connects field from h2
Co-authored-by: JinyLeeChina <[email protected]>
---
.../dolphinscheduler/api/controller/ExecutorController.java | 2 +-
.../api/controller/ProcessDefinitionController.java | 4 ++--
.../java/org/apache/dolphinscheduler/api/enums/Status.java | 2 +-
.../api/service/impl/ProcessDefinitionServiceImpl.java | 13 ++++++-------
sql/dolphinscheduler_h2.sql | 2 --
sql/dolphinscheduler_mysql.sql | 2 --
6 files changed, 10 insertions(+), 15 deletions(-)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
index 0a0b533..f99b774 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
@@ -107,7 +107,7 @@ public class ExecutorController extends BaseController {
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result startProcessInstance(@ApiIgnore @RequestAttribute(value =
Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value =
"PROJECT_CODE", required = true) @PathVariable long projectCode,
- @RequestParam(value =
"processDefinitionCode") int processDefinitionCode,
+ @RequestParam(value =
"processDefinitionCode") long processDefinitionCode,
@RequestParam(value = "scheduleTime",
required = false) String scheduleTime,
@RequestParam(value =
"failureStrategy", required = true) FailureStrategy failureStrategy,
@RequestParam(value = "startNodeList",
required = false) String startNodeList,
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
index 82608e2..a47e422 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
@@ -20,7 +20,7 @@ package org.apache.dolphinscheduler.api.controller;
import static
org.apache.dolphinscheduler.api.enums.Status.BATCH_COPY_PROCESS_DEFINITION_ERROR;
import static
org.apache.dolphinscheduler.api.enums.Status.BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR;
import static
org.apache.dolphinscheduler.api.enums.Status.BATCH_MOVE_PROCESS_DEFINITION_ERROR;
-import static
org.apache.dolphinscheduler.api.enums.Status.CREATE_PROCESS_DEFINITION;
+import static
org.apache.dolphinscheduler.api.enums.Status.CREATE_PROCESS_DEFINITION_ERROR;
import static
org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR;
import static
org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINITION_VERSION_ERROR;
import static
org.apache.dolphinscheduler.api.enums.Status.ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR;
@@ -112,7 +112,7 @@ public class ProcessDefinitionController extends
BaseController {
})
@PostMapping(value = "/save")
@ResponseStatus(HttpStatus.CREATED)
- @ApiException(CREATE_PROCESS_DEFINITION)
+ @ApiException(CREATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createProcessDefinition(@ApiIgnore @RequestAttribute(value =
Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode",
value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
index ca60fd8..ff71113 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
@@ -132,7 +132,7 @@ public enum Status {
AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"),
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error",
"查询任务实例日志错误"),
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log
file error", "下载任务日志文件错误"),
- CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"),
+ CREATE_PROCESS_DEFINITION_ERROR(10105, "create process definition error",
"创建工作流错误"),
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process
definition name unique error", "工作流定义名称验证错误"),
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error",
"更新工作流定义错误"),
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition
error", "上线工作流错误"),
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
index 7c57e66..68007cc 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@@ -219,7 +219,7 @@ public class ProcessDefinitionServiceImpl extends
BaseServiceImpl implements Pro
try {
processDefinitionCode = SnowFlakeUtils.getInstance().nextId();
} catch (SnowFlakeException e) {
- putMsg(result, Status.CREATE_PROCESS_DEFINITION);
+ putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return result;
}
ProcessDefinition processDefinition = new
ProcessDefinition(projectCode, name, processDefinitionCode, description,
@@ -260,15 +260,14 @@ public class ProcessDefinitionServiceImpl extends
BaseServiceImpl implements Pro
int insertVersion = processService.saveProcessDefine(loginUser,
processDefinition, true);
if (insertVersion > 0) {
int insertResult = processService.saveTaskRelation(loginUser,
processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion,
taskRelationList, taskDefinitionLogs);
- if (insertResult > 0) {
+ if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
- // return processDefinitionCode
- result.put(Constants.DATA_LIST, processDefinition.getCode());
+ result.put(Constants.DATA_LIST, processDefinition);
} else {
- putMsg(result, Status.CREATE_PROCESS_DEFINITION);
+ putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
}
} else {
- putMsg(result, Status.CREATE_PROCESS_DEFINITION);
+ putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
@@ -822,7 +821,7 @@ public class ProcessDefinitionServiceImpl extends
BaseServiceImpl implements Pro
try {
processDefinition.setCode(SnowFlakeUtils.getInstance().nextId());
} catch (SnowFlakeException e) {
- putMsg(result, Status.CREATE_PROCESS_DEFINITION);
+ putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinitionLog> taskDefinitionList =
dagDataSchedule.getTaskDefinitionList();
diff --git a/sql/dolphinscheduler_h2.sql b/sql/dolphinscheduler_h2.sql
index a550416..1534395 100644
--- a/sql/dolphinscheduler_h2.sql
+++ b/sql/dolphinscheduler_h2.sql
@@ -381,7 +381,6 @@ CREATE TABLE t_ds_process_definition (
global_params text,
flag tinyint(4) DEFAULT NULL,
locations text,
- connects text,
warning_group_id int(11) DEFAULT NULL,
timeout int(11) DEFAULT '0',
tenant_id int(11) NOT NULL DEFAULT '-1',
@@ -412,7 +411,6 @@ CREATE TABLE t_ds_process_definition_log (
global_params text,
flag tinyint(4) DEFAULT NULL,
locations text,
- connects text,
warning_group_id int(11) DEFAULT NULL,
timeout int(11) DEFAULT '0',
tenant_id int(11) NOT NULL DEFAULT '-1',
diff --git a/sql/dolphinscheduler_mysql.sql b/sql/dolphinscheduler_mysql.sql
index d056b23..74ae862 100644
--- a/sql/dolphinscheduler_mysql.sql
+++ b/sql/dolphinscheduler_mysql.sql
@@ -402,7 +402,6 @@ CREATE TABLE `t_ds_process_definition` (
`global_params` text COMMENT 'global parameters',
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available',
`locations` text COMMENT 'Node location information',
- `connects` text COMMENT 'Node connection information',
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id',
`timeout` int(11) DEFAULT '0' COMMENT 'time out, unit: minute',
`tenant_id` int(11) NOT NULL DEFAULT '-1' COMMENT 'tenant id',
@@ -432,7 +431,6 @@ CREATE TABLE `t_ds_process_definition_log` (
`global_params` text COMMENT 'global parameters',
`flag` tinyint(4) DEFAULT NULL COMMENT '0 not available, 1 available',
`locations` text COMMENT 'Node location information',
- `connects` text COMMENT 'Node connection information',
`warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id',
`timeout` int(11) DEFAULT '0' COMMENT 'time out,unit: minute',
`tenant_id` int(11) NOT NULL DEFAULT '-1' COMMENT 'tenant id',