Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
DolphinScheduler
提交
9a8d07cb
DolphinScheduler
项目概览
xiphi1978
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
2
Star
0
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
未验证
提交
9a8d07cb
编写于
6月 05, 2019
作者:
journey2018
提交者:
GitHub
6月 05, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #430 from qiaozhanwei/branch-1.0.2
kill task need kill sub pids
上级
f8b98d3c
34133365
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
2 deletion
+23
-2
escheduler-common/src/main/java/cn/escheduler/common/utils/OSUtils.java
...mon/src/main/java/cn/escheduler/common/utils/OSUtils.java
+1
-1
escheduler-server/src/main/java/cn/escheduler/server/utils/ProcessUtils.java
...rc/main/java/cn/escheduler/server/utils/ProcessUtils.java
+22
-1
未找到文件。
escheduler-common/src/main/java/cn/escheduler/common/utils/OSUtils.java
浏览文件 @
9a8d07cb
...
...
@@ -220,7 +220,7 @@ public class OSUtils {
* @throws IOException
*/
public
static
String
exeShell
(
String
command
)
throws
IOException
{
return
ShellExecutor
.
execCommand
(
"groups"
);
return
ShellExecutor
.
execCommand
(
command
);
}
/**
...
...
escheduler-server/src/main/java/cn/escheduler/server/utils/ProcessUtils.java
浏览文件 @
9a8d07cb
...
...
@@ -18,6 +18,7 @@ package cn.escheduler.server.utils;
import
cn.escheduler.common.Constants
;
import
cn.escheduler.common.utils.CommonUtils
;
import
cn.escheduler.common.utils.OSUtils
;
import
cn.escheduler.dao.model.TaskInstance
;
import
cn.escheduler.server.rpc.LogClient
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -33,6 +34,7 @@ import java.util.List;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* mainly used to get the start command line of a process
*/
...
...
@@ -139,6 +141,8 @@ public class ProcessUtils {
{
' '
,
'\t'
,
'<'
,
'>'
},
{
' '
,
'\t'
}};
private
static
Matcher
matcher
;
private
static
String
createCommandLine
(
int
verificationType
,
final
String
executablePath
,
final
String
[]
cmd
)
{
StringBuilder
cmdbuf
=
new
StringBuilder
(
80
);
...
...
@@ -256,7 +260,7 @@ public class ProcessUtils {
return
;
}
String
cmd
=
String
.
format
(
"sudo kill -9 %
d"
,
processId
);
String
cmd
=
String
.
format
(
"sudo kill -9 %
s"
,
getPidsStr
(
processId
)
);
logger
.
info
(
"process id:{}, cmd:{}"
,
processId
,
cmd
);
...
...
@@ -270,6 +274,23 @@ public class ProcessUtils {
}
}
/**
* get pids str
* @param processId
* @return
* @throws Exception
*/
private
static
String
getPidsStr
(
int
processId
)
throws
Exception
{
StringBuilder
sb
=
new
StringBuilder
();
// pstree -p pid get sub pids
String
pids
=
OSUtils
.
exeCmd
(
"pstree -p "
+
processId
+
""
);
Matcher
mat
=
Pattern
.
compile
(
"(\\d+)"
).
matcher
(
pids
);
while
(
mat
.
find
()){
sb
.
append
(
mat
.
group
()+
" "
);
}
return
sb
.
toString
().
trim
();
}
/**
* find logs and kill yarn tasks
* @param taskInstance
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录