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
52f237d4
Commit
52f237d4
authored
Apr 10, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
9c9da3b6
a83d1383
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
13 deletions
+40
-13
FlowServiceImpl.java
.../src/main/java/com/byit/service/impl/FlowServiceImpl.java
+6
-8
JobUtils.java
...xecutor-plugin/src/main/java/com/byit/utils/JobUtils.java
+1
-3
ProcessManagerController.java
...in/java/com/byit/controller/ProcessManagerController.java
+4
-1
MythJobProcess.java
...server/src/main/java/com/byit/process/MythJobProcess.java
+5
-0
application-dev.yml
...th-executor-server/src/main/resources/application-dev.yml
+6
-0
application-local.yml
...-executor-server/src/main/resources/application-local.yml
+4
-1
application-pro.yml
...th-executor-server/src/main/resources/application-pro.yml
+7
-0
application-test.yml
...h-executor-server/src/main/resources/application-test.yml
+7
-0
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/FlowServiceImpl.java
View file @
52f237d4
...
...
@@ -331,7 +331,7 @@ public class FlowServiceImpl implements FlowService {
ValidationUtil
.
isTrueValidation
(!
"0"
.
equals
(
innerJobTaskRunLog
.
getRunCode
()),
"该任务已经运行结束!"
);
ValidationUtil
.
dataNotBank
(
innerJobTaskRunLog
.
getJobGroupIp
(),
"尚未分配执行机请稍后再试"
);
}
if
(!
killJob
(
innerJobTaskRunLog
.
getLogId
(),
innerJobTaskRunLog
.
getJobGroupIp
())){
if
(!
killJob
(
innerJobTaskRunLog
.
getLogId
(),
innerJobTaskRunLog
.
getJobGroupIp
())){
result
=
false
;
}
}
...
...
@@ -352,7 +352,7 @@ public class FlowServiceImpl implements FlowService {
@Override
public
Boolean
killFlow
(
String
runId
)
throws
InterruptedException
{
ValidationUtil
.
dataNotBank
(
runId
,
"运行实例不允许
3
为空!"
);
ValidationUtil
.
dataNotBank
(
runId
,
"运行实例不允许为空!"
);
//杀死运行实例
List
<
RunRecording
>
runRecordings
=
runRecordingMapper
.
findUnFinishByRunId
(
runId
);
ValidationUtil
.
dataNotNull
(
runRecordings
,
"该运行id未找到或已经运行完成无需杀死!"
);
...
...
@@ -362,7 +362,7 @@ public class FlowServiceImpl implements FlowService {
//杀死所有的任务
List
<
JobTaskRunLog
>
jobTaskRunLogList
=
jobTaskRunLogMapper
.
findByRunId
(
runId
);
for
(
JobTaskRunLog
jobTaskRunLog
:
jobTaskRunLogList
){
if
(
!
"0"
.
equals
(
jobTaskRunLog
.
getRunCode
())){
if
(
"0"
.
equals
(
jobTaskRunLog
.
getRunCode
())){
if
(
StringUtils
.
isEmpty
(
jobTaskRunLog
.
getJobGroupIp
())){
log
.
warn
(
"已经调度成功但是还未返回具体的调用机器的ip地址"
);
Thread
.
sleep
(
3000
);
...
...
@@ -380,16 +380,15 @@ public class FlowServiceImpl implements FlowService {
private
synchronized
Boolean
killJob
(
Integer
logId
,
String
exectUrl
){
//具体访问的URL
String
killUrl
=
exectUrl
+
"
/processManager/killJob"
;
String
killUrl
=
"http://"
+
exectUrl
+
"/myth-executor-server
/processManager/killJob"
;
Map
<
String
,
Object
>
requestMap
=
new
HashMap
<>(
2
);
requestMap
.
put
(
"logId"
,
logId
);
String
killResult
=
HttpUtil
.
post
(
killUrl
,
requestMap
);
log
.
info
(
"请求结果{}"
,
killResult
);
ResponseResult
responseResult
=
JSON
.
parseObject
(
killResult
,
ResponseResult
.
class
);
if
(
"SUCCESS"
.
equals
(
responseResult
.
getResult
())){
ValidationUtil
.
isTrueValidation
(!
"SUCCESS"
.
equals
(
responseResult
.
getResult
()),
"杀死job失败,错误信息为:"
+
responseResult
.
getResult
());
return
true
;
}
return
false
;
}
}
\ No newline at end of file
byit-myth-executor/myth-executor-plugin/src/main/java/com/byit/utils/JobUtils.java
View file @
52f237d4
...
...
@@ -269,10 +269,8 @@ public class JobUtils {
* @return
*/
public
static
ResponseResult
killFlow
(
String
runId
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
"runId"
,
runId
);
//发送请求 添加任务
String
response
=
createHttpRequest
(
REQUEST_FLOW_KILL_FLOW
,
JSON
.
toJSONString
(
map
)
);
String
response
=
createHttpRequest
(
REQUEST_FLOW_KILL_FLOW
,
"runId="
+
runId
);
log
.
info
(
"--------------------杀死工作流接口调用成功,结果为:{}------------------------"
,
response
);
return
JSON
.
parseObject
(
response
,
ResponseResult
.
class
);
}
...
...
byit-myth-executor/myth-executor-server/src/main/java/com/byit/controller/ProcessManagerController.java
View file @
52f237d4
...
...
@@ -3,6 +3,7 @@ package com.byit.controller;
import
com.byit.process.MythJobProcess
;
import
com.byit.utils.JobContentUtil
;
import
com.byit.utils.ValidationUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -14,14 +15,16 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping
(
"processManager"
)
@Slf4j
public
class
ProcessManagerController
{
@PostMapping
(
"killJob"
)
public
String
killJob
(
Integer
logId
){
ValidationUtil
.
dataNotNull
(
logId
,
"日志id不允许为空!"
);
log
.
info
(
"请求杀死任务,对应logId:【{}】"
,
logId
);
MythJobProcess
mythJobProcess
=
JobContentUtil
.
getJobThread
(
logId
);
ValidationUtil
.
dataNotNull
(
mythJobProcess
,
logId
+
"已经运行结束或还未调用!"
);
mythJobProcess
.
hardKill
();
return
"SUCESS"
;
return
"SUC
C
ESS"
;
}
}
byit-myth-executor/myth-executor-server/src/main/java/com/byit/process/MythJobProcess.java
View file @
52f237d4
...
...
@@ -224,6 +224,8 @@ public class MythJobProcess implements Callable<String>{
log
.
error
(
"尝试杀死失败."
,
e
);
}
}
//如果是杀死将退出值改为-100
exitCode
=
-
100
;
return
false
;
}
else
{
throw
new
IllegalStateException
(
"程序不在运行中"
);
...
...
@@ -234,6 +236,7 @@ public class MythJobProcess implements Callable<String>{
* 强制杀死这个过程
*/
public
void
hardKill
()
{
log
.
info
(
"强制杀死这个过程"
);
//判断是否已经开始运行
checkStarted
();
//判断是否正在执行
...
...
@@ -254,6 +257,8 @@ public class MythJobProcess implements Callable<String>{
}
}
this
.
process
.
destroy
();
//如果是杀死将退出值改为-100
exitCode
=
-
100
;
}
else
{
throw
new
IllegalStateException
(
"程序不在运行中"
);
}
...
...
byit-myth-executor/myth-executor-server/src/main/resources/application-dev.yml
View file @
52f237d4
...
...
@@ -24,3 +24,8 @@ spring:
port
:
6379
password
:
authentication
:
user
:
header-name
:
token
expire
:
43200
# 外部token有效期为12小时
pub-key
:
client/pub.key
# 解密
\ No newline at end of file
byit-myth-executor/myth-executor-server/src/main/resources/application-local.yml
View file @
52f237d4
...
...
@@ -25,4 +25,6 @@ spring:
password
:
authentication
:
user
:
pub-key
:
"
huangfu"
header-name
:
token
expire
:
43200
# 外部token有效期为12小时
pub-key
:
client/pub.key
# 解密
\ No newline at end of file
byit-myth-executor/myth-executor-server/src/main/resources/application-pro.yml
View file @
52f237d4
...
...
@@ -24,3 +24,9 @@ spring:
host
:
${Redis_IP}
port
:
${Redis_port}
password
:
authentication
:
user
:
header-name
:
token
expire
:
43200
# 外部token有效期为12小时
pub-key
:
client/pub.key
# 解密
\ No newline at end of file
byit-myth-executor/myth-executor-server/src/main/resources/application-test.yml
View file @
52f237d4
...
...
@@ -24,3 +24,9 @@ spring:
host
:
${Redis_IP}
port
:
${Redis_port}
password
:
authentication
:
user
:
header-name
:
token
expire
:
43200
# 外部token有效期为12小时
pub-key
:
client/pub.key
# 解密
\ No newline at end of file
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