You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/07/05 05:43:11 UTC
[GitHub] [dolphinscheduler] skymsg commented on a change in pull request #5665: [Improvement][Worker] Do not verify the status of yarn in ShellCommandExecutor
skymsg commented on a change in pull request #5665:
URL: https://github.com/apache/dolphinscheduler/pull/5665#discussion_r663651632
##########
File path: dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/AbstractCommandExecutor.java
##########
@@ -207,17 +203,10 @@ public CommandExecuteResult run(String execCommand) throws Exception {
// if SHELL task exit
if (status) {
- // set appIds
- List<String> appIds = getAppIds(taskExecutionContext.getLogPath());
- result.setAppIds(String.join(Constants.COMMA, appIds));
// SHELL task state
result.setExitStatusCode(process.exitValue());
- // if yarn task , yarn state is final state
- if (process.exitValue() == 0) {
- result.setExitStatusCode(isSuccessOfYarnState(appIds) ? EXIT_CODE_SUCCESS : EXIT_CODE_FAILURE);
- }
} else {
logger.error("process has failure , exitStatusCode:{}, processExitValue:{}, ready to kill ...",
result.getExitStatusCode(), process.exitValue());
Review comment:
just remove the killYarnJob call from kill method maybe enough .
```java
public static void kill(TaskExecutionContext taskExecutionContext) {
try {
int processId = taskExecutionContext.getProcessId();
if (processId == 0) {
logger.error("process kill failed, process id :{}, task id:{}",
processId, taskExecutionContext.getTaskInstanceId());
return;
}
String pidsStr = getPidsStr(processId);
if (StringUtils.isNotEmpty(pidsStr)) {
String cmd = String.format("kill -9 %s", pidsStr);
cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd);
logger.info("process id:{}, cmd:{}", processId, cmd);
OSUtils.exeCmd(cmd);
}
} catch (Exception e) {
logger.error("kill task failed", e);
}
// find log and kill yarn job
killYarnJob(taskExecutionContext);
}
```
I found the TaskExecuteThread would call the cancelApplication to kill the yarn job when AbstractYarnTask handle method throws Exception.
--
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: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org