ruanwenjun commented on code in PR #13689:
URL:
https://github.com/apache/dolphinscheduler/pull/13689#discussion_r1130347103
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java:
##########
@@ -278,53 +276,18 @@ public String getVarPool() {
return varPool.toString();
}
- /**
- * cancel application
- *
- * @throws Exception exception
- */
- public void cancelApplication() throws Exception {
+ public void cancelApplication() {
if (process == null) {
return;
}
- int processId = getProcessId(process);
- logger.info("Begin to kill process process, pid is : {}", processId);
- // kill , waiting for completion
- boolean alive = softKill(processId);
-
- if (alive) {
- String cmd = String.format("kill -9 %s", getPidsStr(processId));
- cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd);
- OSUtils.exeCmd(cmd);
- logger.info("Success kill task: {}, pid: {}, cmd: {}",
taskRequest.getTaskAppId(), processId, cmd);
- } else {
- logger.info("The process: {} is not alive, no need to kill",
processId);
+ // soft kill
+ logger.info("Begin to kill process process, pid is : {}",
taskRequest.getProcessId());
+ process.destroy();
+ if (process.isAlive()) {
+ process.destroyForcibly();
Review Comment:
Done, thanks for your suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]