Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
cdb0745a
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
704
Star
9572
Fork
3514
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
cdb0745a
编写于
2月 03, 2021
作者:
K
Kirs
提交者:
GitHub
2月 03, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "[1.3.5-prepare][cherry-pick]#4555 update branch name error (#4662)" (#4670)
This reverts commit
14daebd7
.
上级
14daebd7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
5 addition
and
186 deletion
+5
-186
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
...olphinscheduler/api/service/ProcessDefinitionService.java
+0
-4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
.../dolphinscheduler/api/service/ProcessInstanceService.java
+5
-9
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/conditions/ConditionsParameters.java
...cheduler/common/task/conditions/ConditionsParameters.java
+0
-7
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
...ache/dolphinscheduler/service/process/ProcessService.java
+0
-57
dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
.../dolphinscheduler/service/process/ProcessServiceTest.java
+0
-109
未找到文件。
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
浏览文件 @
cdb0745a
...
...
@@ -403,10 +403,6 @@ public class ProcessDefinitionService extends BaseDAGService {
}
}
// get the processdefinitionjson before saving,and then save the name and taskid
String
oldJson
=
processDefine
.
getProcessDefinitionJson
();
processDefinitionJson
=
processService
.
changeJson
(
processData
,
oldJson
);
Date
now
=
new
Date
();
processDefine
.
setId
(
id
);
...
...
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
浏览文件 @
cdb0745a
...
...
@@ -359,15 +359,16 @@ public class ProcessInstanceService extends BaseDAGService {
processInstance
.
getName
(),
processInstance
.
getState
().
toString
(),
"update"
);
return
result
;
}
Date
schedule
;
schedule
=
processInstance
.
getScheduleTime
();
Date
schedule
=
null
;
if
(
scheduleTime
!=
null
)
{
schedule
=
DateUtils
.
getScheduleDate
(
scheduleTime
);
}
else
{
schedule
=
processInstance
.
getScheduleTime
();
}
processInstance
.
setScheduleTime
(
schedule
);
processInstance
.
setLocations
(
locations
);
processInstance
.
setConnects
(
connects
);
String
globalParams
;
String
globalParams
=
null
;
String
originDefParams
=
null
;
int
timeout
=
processInstance
.
getTimeout
();
ProcessDefinition
processDefinition
=
processService
.
findProcessDefineById
(
processInstance
.
getProcessDefinitionId
());
...
...
@@ -391,18 +392,13 @@ public class ProcessInstanceService extends BaseDAGService {
if
(
tenant
!=
null
){
processInstance
.
setTenantCode
(
tenant
.
getTenantCode
());
}
// get the processinstancejson before saving,and then save the name and taskid
String
oldJson
=
processInstance
.
getProcessInstanceJson
();
if
(
StringUtils
.
isNotEmpty
(
oldJson
))
{
processInstanceJson
=
processService
.
changeJson
(
processData
,
oldJson
);
}
processInstance
.
setProcessInstanceJson
(
processInstanceJson
);
processInstance
.
setGlobalParams
(
globalParams
);
}
int
update
=
processService
.
updateProcessInstance
(
processInstance
);
int
updateDefine
=
1
;
if
(
Boolean
.
TRUE
.
equals
(
syncDefine
))
{
if
(
Boolean
.
TRUE
.
equals
(
syncDefine
)
&&
StringUtils
.
isNotEmpty
(
processInstanceJson
)
)
{
processDefinition
.
setProcessDefinitionJson
(
processInstanceJson
);
processDefinition
.
setGlobalParams
(
originDefParams
);
processDefinition
.
setLocations
(
locations
);
...
...
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/conditions/ConditionsParameters.java
浏览文件 @
cdb0745a
...
...
@@ -36,13 +36,6 @@ public class ConditionsParameters extends AbstractParameters {
private
List
<
String
>
failedNode
;
public
String
getConditionResult
()
{
return
"{"
+
"\"successNode\": [\""
+
successNode
.
get
(
0
)
+
"\"],\"failedNode\": [\""
+
failedNode
.
get
(
0
)
+
"\"]}"
;
}
@Override
public
boolean
checkParameters
()
{
return
true
;
...
...
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
浏览文件 @
cdb0745a
...
...
@@ -25,7 +25,6 @@ import org.apache.dolphinscheduler.common.enums.*;
import
org.apache.dolphinscheduler.common.model.DateInterval
;
import
org.apache.dolphinscheduler.common.model.TaskNode
;
import
org.apache.dolphinscheduler.common.process.Property
;
import
org.apache.dolphinscheduler.common.task.conditions.ConditionsParameters
;
import
org.apache.dolphinscheduler.common.task.subprocess.SubProcessParameters
;
import
org.apache.dolphinscheduler.common.utils.*
;
import
org.apache.dolphinscheduler.dao.entity.*
;
...
...
@@ -1907,60 +1906,4 @@ public class ProcessService {
taskInstance
.
getId
());
}
/**
* solve the branch rename bug
*
* @param processData
* @param oldJson
* @return String
*/
public
String
changeJson
(
ProcessData
processData
,
String
oldJson
)
{
ProcessData
oldProcessData
=
JSONUtils
.
parseObject
(
oldJson
,
ProcessData
.
class
);
HashMap
<
String
,
String
>
oldNameTaskId
=
new
HashMap
<>();
List
<
TaskNode
>
oldTasks
=
oldProcessData
.
getTasks
();
for
(
int
i
=
0
;
i
<
oldTasks
.
size
();
i
++)
{
TaskNode
taskNode
=
oldTasks
.
get
(
i
);
String
oldName
=
taskNode
.
getName
();
String
oldId
=
taskNode
.
getId
();
oldNameTaskId
.
put
(
oldName
,
oldId
);
}
// take the processdefinitionjson saved this time, and then save the taskid and name
HashMap
<
String
,
String
>
newNameTaskId
=
new
HashMap
<>();
List
<
TaskNode
>
newTasks
=
processData
.
getTasks
();
for
(
int
i
=
0
;
i
<
newTasks
.
size
();
i
++)
{
TaskNode
taskNode
=
newTasks
.
get
(
i
);
String
newId
=
taskNode
.
getId
();
String
newName
=
taskNode
.
getName
();
newNameTaskId
.
put
(
newId
,
newName
);
}
// replace the previous conditionresult with a new one
List
<
TaskNode
>
tasks
=
processData
.
getTasks
();
for
(
int
i
=
0
;
i
<
tasks
.
size
();
i
++)
{
TaskNode
taskNode
=
newTasks
.
get
(
i
);
String
type
=
taskNode
.
getType
();
if
(
TaskType
.
CONDITIONS
.
getDescp
().
equalsIgnoreCase
(
type
))
{
ConditionsParameters
conditionsParameters
=
JSONUtils
.
parseObject
(
taskNode
.
getConditionResult
(),
ConditionsParameters
.
class
);
String
oldSuccessNodeName
=
conditionsParameters
.
getSuccessNode
().
get
(
0
);
String
oldFailedNodeName
=
conditionsParameters
.
getFailedNode
().
get
(
0
);
String
newSuccessNodeName
=
newNameTaskId
.
get
(
oldNameTaskId
.
get
(
oldSuccessNodeName
));
String
newFailedNodeName
=
newNameTaskId
.
get
(
oldNameTaskId
.
get
(
oldFailedNodeName
));
if
(
newSuccessNodeName
!=
null
)
{
ArrayList
<
String
>
successNode
=
new
ArrayList
<>();
successNode
.
add
(
newSuccessNodeName
);
conditionsParameters
.
setSuccessNode
(
successNode
);
}
if
(
newFailedNodeName
!=
null
)
{
ArrayList
<
String
>
failedNode
=
new
ArrayList
<>();
failedNode
.
add
(
newFailedNodeName
);
conditionsParameters
.
setFailedNode
(
failedNode
);
}
String
conditionResultStr
=
conditionsParameters
.
getConditionResult
();
taskNode
.
setConditionResult
(
conditionResultStr
);
tasks
.
set
(
i
,
taskNode
);
}
}
return
JSONUtils
.
toJsonString
(
processData
);
}
}
dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
浏览文件 @
cdb0745a
...
...
@@ -19,17 +19,12 @@ package org.apache.dolphinscheduler.service.process;
import
org.apache.dolphinscheduler.common.Constants
;
import
org.apache.dolphinscheduler.common.enums.CommandType
;
import
org.apache.dolphinscheduler.common.enums.WarningType
;
import
org.apache.dolphinscheduler.common.model.TaskNode
;
import
org.apache.dolphinscheduler.common.task.conditions.ConditionsParameters
;
import
org.apache.dolphinscheduler.common.utils.JSONUtils
;
import
org.apache.dolphinscheduler.dao.entity.Command
;
import
org.apache.dolphinscheduler.dao.entity.ProcessData
;
import
org.apache.dolphinscheduler.dao.entity.ProcessInstance
;
import
org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap
;
import
org.apache.dolphinscheduler.dao.entity.TaskInstance
;
import
java.util.ArrayList
;
import
org.junit.Assert
;
import
org.junit.Test
;
...
...
@@ -107,110 +102,6 @@ public class ProcessServiceTest {
);
Assert
.
assertEquals
(
CommandType
.
START_FAILURE_TASK_PROCESS
,
command
.
getCommandType
());
}
@Test
public
void
testChangeJson
()
{
ProcessData
oldProcessData
=
new
ProcessData
();
ConditionsParameters
conditionsParameters
=
new
ConditionsParameters
();
ArrayList
<
TaskNode
>
tasks
=
new
ArrayList
<>();
TaskNode
taskNode
=
new
TaskNode
();
TaskNode
taskNode11
=
new
TaskNode
();
TaskNode
taskNode111
=
new
TaskNode
();
ArrayList
<
String
>
successNode
=
new
ArrayList
<>();
ArrayList
<
String
>
faildNode
=
new
ArrayList
<>();
taskNode
.
setName
(
"bbb"
);
taskNode
.
setType
(
"SHELL"
);
taskNode
.
setId
(
"222"
);
taskNode11
.
setName
(
"vvv"
);
taskNode11
.
setType
(
"CONDITIONS"
);
taskNode11
.
setId
(
"444"
);
successNode
.
add
(
"bbb"
);
faildNode
.
add
(
"ccc"
);
taskNode111
.
setName
(
"ccc"
);
taskNode111
.
setType
(
"SHELL"
);
taskNode111
.
setId
(
"333"
);
conditionsParameters
.
setSuccessNode
(
successNode
);
conditionsParameters
.
setFailedNode
(
faildNode
);
taskNode11
.
setConditionResult
(
conditionsParameters
.
getConditionResult
());
tasks
.
add
(
taskNode
);
tasks
.
add
(
taskNode11
);
tasks
.
add
(
taskNode111
);
oldProcessData
.
setTasks
(
tasks
);
ProcessData
newProcessData
=
new
ProcessData
();
ConditionsParameters
conditionsParameters2
=
new
ConditionsParameters
();
TaskNode
taskNode2
=
new
TaskNode
();
TaskNode
taskNode22
=
new
TaskNode
();
TaskNode
taskNode222
=
new
TaskNode
();
ArrayList
<
TaskNode
>
tasks2
=
new
ArrayList
<>();
ArrayList
<
String
>
successNode2
=
new
ArrayList
<>();
ArrayList
<
String
>
faildNode2
=
new
ArrayList
<>();
taskNode2
.
setName
(
"bbbchange"
);
taskNode2
.
setType
(
"SHELL"
);
taskNode2
.
setId
(
"222"
);
taskNode22
.
setName
(
"vv"
);
taskNode22
.
setType
(
"CONDITIONS"
);
taskNode22
.
setId
(
"444"
);
successNode2
.
add
(
"bbb"
);
faildNode2
.
add
(
"ccc"
);
taskNode222
.
setName
(
"ccc"
);
taskNode222
.
setType
(
"SHELL"
);
taskNode222
.
setId
(
"333"
);
conditionsParameters2
.
setSuccessNode
(
successNode2
);
conditionsParameters2
.
setFailedNode
(
faildNode2
);
taskNode22
.
setConditionResult
(
conditionsParameters2
.
getConditionResult
());
tasks2
.
add
(
taskNode2
);
tasks2
.
add
(
taskNode22
);
tasks2
.
add
(
taskNode222
);
newProcessData
.
setTasks
(
tasks2
);
ProcessData
exceptProcessData
=
new
ProcessData
();
ConditionsParameters
conditionsParameters3
=
new
ConditionsParameters
();
TaskNode
taskNode3
=
new
TaskNode
();
TaskNode
taskNode33
=
new
TaskNode
();
TaskNode
taskNode333
=
new
TaskNode
();
ArrayList
<
TaskNode
>
tasks3
=
new
ArrayList
<>();
ArrayList
<
String
>
successNode3
=
new
ArrayList
<>();
ArrayList
<
String
>
faildNode3
=
new
ArrayList
<>();
taskNode3
.
setName
(
"bbbchange"
);
taskNode3
.
setType
(
"SHELL"
);
taskNode3
.
setId
(
"222"
);
taskNode33
.
setName
(
"vv"
);
taskNode33
.
setType
(
"CONDITIONS"
);
taskNode33
.
setId
(
"444"
);
successNode3
.
add
(
"bbbchange"
);
faildNode3
.
add
(
"ccc"
);
taskNode333
.
setName
(
"ccc"
);
taskNode333
.
setType
(
"SHELL"
);
taskNode333
.
setId
(
"333"
);
conditionsParameters3
.
setSuccessNode
(
successNode3
);
conditionsParameters3
.
setFailedNode
(
faildNode3
);
taskNode33
.
setConditionResult
(
conditionsParameters3
.
getConditionResult
());
tasks3
.
add
(
taskNode3
);
tasks3
.
add
(
taskNode33
);
tasks3
.
add
(
taskNode333
);
exceptProcessData
.
setTasks
(
tasks3
);
String
expect
=
JSONUtils
.
toJsonString
(
exceptProcessData
);
String
oldJson
=
JSONUtils
.
toJsonString
(
oldProcessData
);
Assert
.
assertEquals
(
expect
,
new
ProcessService
().
changeJson
(
newProcessData
,
oldJson
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录