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
fc5dbe84
Commit
fc5dbe84
authored
Jan 04, 2021
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xi解决冲突
parent
582185bb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
33 deletions
+30
-33
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+25
-31
ApiNodeServiceImpl.java
...c/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
+3
-1
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+2
-1
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
fc5dbe84
...
...
@@ -1527,21 +1527,18 @@ public class ApiFlowServiceImpl implements ApiFlowService {
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
Workspace
byName
=
workspaceMapper
.
getByName
(
workspaceName
);
ValidationUtil
.
isTrueValidation
(
byName
==
null
,
"没有此工作空间"
);
List
<
RunRecording
>
runRecordingList
=
runRecordingMapper
.
runIngRunRecording
(
flowName
,
byName
.
getWorkspaceId
());
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
runRecordingList
),
"没有正在运行中的实例!"
);
runRecordingList
.
forEach
(
runRecording
->
{
if
(
"3"
.
equals
(
runRecording
.
getFlowStatus
()))
{
List
<
RunRecording
>
runRecordings
=
runRecordingMapper
.
runIngRunRecording
(
flowName
,
byName
.
getWorkspaceId
());
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
runRecordings
),
"没有正在运行中的实例!"
);
List
<
RunRecording
>
collect
=
runRecordings
.
stream
().
filter
(
runRecording
->
"3"
.
equals
(
runRecording
.
getFlowStatus
())).
collect
(
Collectors
.
toList
());
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
collect
),
"没有暂停的实例!"
);
List
<
String
>
runIds
=
collect
.
stream
().
map
(
RunRecording:
:
getRunId
).
collect
(
Collectors
.
toList
());
String
join
=
StringUtils
.
join
(
runIds
,
","
);
StopFlowParam
stopFlowParam
=
new
StopFlowParam
();
stopFlowParam
.
setRunIds
(
runRecording
.
getRunId
()
);
stopFlowParam
.
setRunIds
(
join
);
stopFlowParam
.
setFlowName
(
flowName
);
stopFlowParam
.
setAllStartFlow
(
"1"
);
reStartSchedule
(
stopFlowParam
);
}
else
{
log
.
warn
(
"{},不是出于暂停状态"
,
runRecording
);
}
});
}
/**
...
...
@@ -1655,31 +1652,28 @@ public class ApiFlowServiceImpl implements ApiFlowService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
stopSchedule
(
String
param
)
{
DeleteDto
deleteDto
=
new
DeleteDto
();
parseParam
(
param
,
deleteDto
);
String
workspaceName
=
deleteDto
.
getWorkspaceName
();
String
flowName
=
deleteDto
.
getFlowName
();
log
.
debug
(
"停止工作空间【{}】---工作流【{}】调度"
,
workspaceName
,
flowName
);
Workspace
workspace
=
workspaceMapper
.
getByName
(
workspaceName
);
ValidationUtil
.
dataNotNull
(
workspace
,
workspaceName
+
"工作空间不存在"
);
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
//ValidationUtil.isTrueValidation(FlowPropertyEnum.IS_INNER.getCode().equals(flow.getIsInner()), "内嵌工作流不允许暂停调度!");
//判断是否在调度中
List
<
RunRecording
>
recordingList
=
runRecordingMapper
.
findUnFinishByFlowId
(
flow
.
getFlowId
());
ValidationUtil
.
isTrueValidation
(
CollectionUtil
.
isEmpty
(
recordingList
),
flowName
+
"工作流没有正在运行的调度!"
);
StringBuffer
runids
=
new
StringBuffer
();
//暂停工作流调度
recordingList
.
forEach
(
runRecording
->
{
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
//获取工作空间名称
String
workspaceName
=
jsonObject
.
getString
(
"workspaceName"
);
ValidationUtil
.
dataNotBank
(
workspaceName
,
"工作空间名称不允许为空!"
);
//获取工作流名称
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
//获取工作流名称
String
runId
=
jsonObject
.
getString
(
"runId"
);
ValidationUtil
.
dataNotBank
(
runId
,
"工作流运行标识不允许为空!"
);
RunRecording
runRecording
=
runRecordingMapper
.
findAllByRunIDAndFlowName
(
runId
,
flowName
);
if
(
RunRecordingEnum
.
FAIL_FAST_YES
.
getCode
().
equals
(
runRecording
.
getFailFast
()))
{
throw
new
RuntimeException
(
String
.
format
(
"实例%s是快速失败状态"
,
runRecording
.
getFlowName
()));
}
//runRecordingMapper.stopByRunIdAndFlowId(runRecording.getRunId(), runRecording.getFlowId());
runRecordingMapper
.
stopByRunIdAndFlowId
(
runRecording
.
getRunId
(),
runRecording
.
getFlowId
());
jobTaskMapper
.
stopByRunIdAndFlowId
(
runRecording
.
getRunId
(),
runRecording
.
getFlowId
());
runids
.
append
(
runRecording
.
getRunId
()
+
","
);
});
return
runids
.
toString
();
return
runId
;
}
@Override
...
...
byit-myth-admin/src/main/java/com/byit/service/impl/ApiNodeServiceImpl.java
View file @
fc5dbe84
...
...
@@ -249,7 +249,9 @@ public class ApiNodeServiceImpl implements ApiNodeService {
public
void
deleteJavaTask
(
String
jobName
)
{
ValidationUtil
.
dataNotBank
(
jobName
,
"jobName不允许为空!"
);
JavaTask
javaTask
=
javaTaskMapper
.
findByJobName
(
jobName
);
ValidationUtil
.
dataNotNull
(
javaTask
,
"没有此任务实例!"
);
if
(
javaTask
==
null
){
return
;
}
javaTaskMapper
.
deleteByJobName
(
jobName
);
}
...
...
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
fc5dbe84
...
...
@@ -429,10 +429,11 @@ public class JobUtils {
* @param workspaceName
* @return
*/
public
static
ResponseResult
stopFlow
(
String
flowName
,
String
workspaceName
)
{
public
static
ResponseResult
stopFlow
(
String
flowName
,
String
workspaceName
,
String
runId
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
5
);
map
.
put
(
"flowName"
,
flowName
);
map
.
put
(
"workspaceName"
,
workspaceName
);
map
.
put
(
"runId"
,
runId
);
//发送请求 添加任务
String
response
=
createHttpRequest
(
REQUEST_FLOW_STOP
,
"param="
+
JSON
.
toJSONString
(
map
,
WriteClassName
));
log
.
debug
(
"--------------------暂停接口调用成功,结果为:{}------------------------"
,
response
);
...
...
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