Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
31c58003
Commit
31c58003
authored
Apr 10, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
a27aab9e
35dda7b5
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
61 additions
and
11 deletions
+61
-11
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+3
-1
JobTaskRunLogMapper.java
...re/src/main/java/com/byit/mapper/JobTaskRunLogMapper.java
+9
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+1
-1
FlowServiceImpl.java
.../src/main/java/com/byit/service/impl/FlowServiceImpl.java
+22
-4
FlowStatusSnapshootMapper.xml
...e/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
+1
-2
JobTaskRunLogMapper.xml
...in-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
+12
-0
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+7
-1
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+6
-2
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
31c58003
...
...
@@ -280,7 +280,9 @@ public class ApiFlowServiceImpl implements ApiFlowService {
//设置失败重试
if
(
null
!=
((
PluginNode
)
pluginNode
).
getConfig
().
getFailedRetryCount
()){
node
.
setFailedRetryCount
(((
PluginNode
)
pluginNode
).
getConfig
().
getFailedRetryCount
());
node
.
setFailedRetryInterval
(((
PluginNode
)
pluginNode
).
getConfig
().
getFailedRetryInterval
());
node
.
setFailedRetryInterval
(
null
==
((
PluginNode
)
pluginNode
).
getConfig
().
getFailedRetryInterval
()
?
3000
:
((
PluginNode
)
pluginNode
).
getConfig
().
getFailedRetryInterval
());
}
else
{
node
.
setFailedRetryCount
(
0
);
}
//设置剩余执行次数
if
(
null
!=
((
PluginNode
)
pluginNode
).
getConfig
().
getRepeatCount
()
&&
!
"-1"
.
equals
(((
PluginNode
)
pluginNode
).
getConfig
().
getRepeatCount
())){
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/JobTaskRunLogMapper.java
View file @
31c58003
...
...
@@ -125,4 +125,12 @@ public interface JobTaskRunLogMapper {
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
StatisticData
findStatisticDataByRunIdAndFlowId
(
@Param
(
"runId"
)
String
runId
,
@Param
(
"flowId"
)
Integer
flowId
);
/**
* 根据runid和flowidlist获取运行日志
* @param runId
* @param flowIdList
* @return
*/
List
<
JobTaskRunLog
>
findbyRunIdAndFlowIdList
(
@Param
(
"runId"
)
String
runId
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
31c58003
...
...
@@ -137,7 +137,7 @@ public interface RunRecordingMapper {
* @param runId
* @return
*/
RunRecording
findUnFinishByRunId
(
@Param
(
"runId"
)
String
runId
,
@Param
(
"flowId"
)
Integer
flowId
);
List
<
RunRecording
>
findUnFinishByRunId
(
@Param
(
"runId"
)
String
runId
,
@Param
(
"flowIdList"
)
List
<
Integer
>
flowIdList
);
List
<
RunRecording
>
findByStartAndEndTime
(
@Param
(
"startDate"
)
Date
startDate
,
@Param
(
"endDate"
)
Date
endDate
,
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/FlowServiceImpl.java
View file @
31c58003
...
...
@@ -364,17 +364,34 @@ public class FlowServiceImpl implements FlowService {
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
List
<
Integer
>
flowIdList
=
new
ArrayList
<>();
Queue
<
Integer
>
queue
=
new
LinkedList
<>();
flowIdList
.
add
(
flow
.
getFlowId
());
queue
.
offer
(
flow
.
getFlowId
());
while
(!
queue
.
isEmpty
()){
List
<
Node
>
innerFlowList
=
nodeMapper
.
findVirtualByFlowId
(
queue
.
poll
());
if
(
null
!=
innerFlowList
&&
innerFlowList
.
size
()
>
0
){
innerFlowList
.
forEach
(
node
->
{
flowIdList
.
add
(
node
.
getMapFlowId
());
queue
.
offer
(
node
.
getMapFlowId
());
});
}
}
//杀死运行实例
RunRecording
runRecording
=
runRecordingMapper
.
findUnFinishByRunId
(
runId
,
flow
.
getFlowId
()
);
ValidationUtil
.
dataNotNull
(
runRecording
,
"该运行id未找到或已经运行完成无需杀死!"
);
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
findUnFinishByRunId
(
runId
,
flowIdList
);
ValidationUtil
.
dataNotNull
(
runRecording
List
,
"该运行id未找到或已经运行完成无需杀死!"
);
Boolean
result
=
true
;
runRecordingList
.
forEach
(
runRecording
->
{
//将未完成的运行实例设置为完成且杀死
runRecording
.
setFlowStatus
(
"4"
);
runRecording
.
setFlowRunResult
(
"5"
);
runRecordingMapper
.
updateRunRecordingById
(
runRecording
);
});
//杀死所有的任务
List
<
JobTaskRunLogWithBLOBs
>
jobTaskRunLogList
=
jobTaskRunLogMapper
.
findJobTaskRunLogWithBLOBsByFlowIdAndRunId
(
flow
.
getFlowId
(),
runId
);
for
(
JobTaskRunLogWithBLOBs
jobTaskRunLog
:
jobTaskRunLogList
){
List
<
JobTaskRunLog
>
jobTaskRunLogList
=
jobTaskRunLogMapper
.
findbyRunIdAndFlowIdList
(
runId
,
flowIdList
);
if
(
null
!=
jobTaskRunLogList
&&
jobTaskRunLogList
.
size
()
>
0
){
for
(
JobTaskRunLog
jobTaskRunLog
:
jobTaskRunLogList
){
if
(
"0"
.
equals
(
jobTaskRunLog
.
getRunCode
())){
if
(
StringUtils
.
isEmpty
(
jobTaskRunLog
.
getJobGroupIp
())){
log
.
warn
(
"已经调度成功但是还未返回具体的调用机器的ip地址"
);
...
...
@@ -388,6 +405,7 @@ public class FlowServiceImpl implements FlowService {
}
}
}
}
return
result
;
}
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/FlowStatusSnapshootMapper.xml
View file @
31c58003
...
...
@@ -217,7 +217,7 @@
<insert
id=
"saveList"
parameterType=
"com.byit.model.FlowStatusSnapshoot"
>
INSERT INTO flow_status_snapshoot
(
status_id,
workspace_id, flow_id,
workspace_id, flow_id,
flow_name, `day`, `hour`,
flow_status, snapshoot_time, unstart_node,
runing_node, success_node, fail_node,
...
...
@@ -226,7 +226,6 @@
VALUES
<foreach
collection=
"flowStatusSnapshootList"
item=
"flowStatusSnapshoot"
separator=
","
>
(
#{flowStatusSnapshoot.statusId,jdbcType=INTEGER},
#{flowStatusSnapshoot.workspaceId,jdbcType=INTEGER},
#{flowStatusSnapshoot.flowId,jdbcType=INTEGER},
#{flowStatusSnapshoot.flowName,jdbcType=VARCHAR},
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/JobTaskRunLogMapper.xml
View file @
31c58003
...
...
@@ -148,6 +148,18 @@
where run_id = #{runId}
and flow_id = #{flowId}
</select>
<select
id=
"findbyRunIdAndFlowIdList"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from job_task_run_log
where run_id = #{runId}
<if
test=
"flowIdList != null"
>
and flow_id in (
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
#{flowId}
</foreach>
)
</if>
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
delete from job_task_run_log
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
31c58003
...
...
@@ -103,8 +103,14 @@
<include
refid=
"Base_Column_List"
/>
from run_recording
where run_id = #{runId,jdbcType=VARCHAR}
and flow_id = #{flowId,jdbcType=INTEGER}
and flow_status != '4'
<if
test=
"flowIdList != null"
>
and flow_id in (
<foreach
collection=
"flowIdList"
item=
"flowId"
separator=
","
>
#{flowId}
</foreach>
)
</if>
</select>
<select
id=
"findByStartAndEndTime"
resultMap=
"BaseResultMap"
>
select
...
...
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
31c58003
...
...
@@ -268,9 +268,13 @@ public class JobUtils {
* @param runId
* @return
*/
public
static
ResponseResult
killFlow
(
String
runId
){
public
static
ResponseResult
killFlow
(
String
runId
,
String
flowName
,
String
workspaceName
){
Map
<
String
,
String
>
map
=
new
HashMap
<>(
5
);
map
.
put
(
"runId"
,
runId
);
map
.
put
(
"flowName"
,
flowName
);
map
.
put
(
"workspaceName"
,
workspaceName
);
//发送请求 添加任务
String
response
=
createHttpRequest
(
REQUEST_FLOW_KILL_FLOW
,
"
runId="
+
runId
);
String
response
=
createHttpRequest
(
REQUEST_FLOW_KILL_FLOW
,
"
param="
+
JSON
.
toJSONString
(
map
,
WriteClassName
)
);
log
.
info
(
"--------------------杀死工作流接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment