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 2020/04/13 06:47:09 UTC

[GitHub] [incubator-dolphinscheduler] JunjianS opened a new issue #2407: how does ds check if a process failed ?

JunjianS opened a new issue #2407: how does ds check if a process failed ?
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2407
 
 
   warning will be triggered when a process failed, i wonder how does ds check if a process failed. is there any standard rules for specified task(shell, spark,sql, sp...)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-dolphinscheduler] dailidong commented on issue #2407: how does ds check if a process failed ?

Posted by GitBox <gi...@apache.org>.
dailidong commented on issue #2407: how does ds check if a process failed ?
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2407#issuecomment-612792524
 
 
   you can see the AbstractCommandExecutor.java.
   
   public CommandExecuteResult run(String execCommand) throws Exception{
   
           CommandExecuteResult result = new CommandExecuteResult();
   
   
           if (StringUtils.isEmpty(execCommand)) {
               return result;
           }
   
           String commandFilePath = buildCommandFilePath();
   
           // create command file if not exists
           createCommandFileIfNotExists(execCommand, commandFilePath);
   
           //build process
           buildProcess(commandFilePath);
   
           // parse process output
           parseProcessOutput(process);
   
   
           Integer processId = getProcessId(process);
   
           result.setProcessId(processId);
   
           // cache processId
           taskExecutionContext.setProcessId(processId);
           taskExecutionContextCacheManager.cacheTaskExecutionContext(taskExecutionContext);
   
           // print process id
           logger.info("process start, process id is: {}", processId);
   
           // if timeout occurs, exit directly
           long remainTime = getRemaintime();
   
           // waiting for the run to finish
           boolean status = process.waitFor(remainTime, TimeUnit.SECONDS);
   
   
           logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{}",
                   taskExecutionContext.getExecutePath(),
                   processId
                   , result.getExitStatusCode());
   
           // 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 : {} , ready to kill ...", result.getExitStatusCode());
               ProcessUtils.kill(taskExecutionContext);
               result.setExitStatusCode(EXIT_CODE_FAILURE);
           }
   
   
           return result;
       }

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-dolphinscheduler] dailidong edited a comment on issue #2407: how does ds check if a process failed ?

Posted by GitBox <gi...@apache.org>.
dailidong edited a comment on issue #2407: how does ds check if a process failed ?
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2407#issuecomment-612792524
 
 
   you can see the AbstractCommandExecutor.java. the mainly code as follow:
   
   public CommandExecuteResult run(String execCommand) throws Exception{
   
           CommandExecuteResult result = new CommandExecuteResult();
   
   
           if (StringUtils.isEmpty(execCommand)) {
               return result;
           }
   
           String commandFilePath = buildCommandFilePath();
   
           // create command file if not exists
           createCommandFileIfNotExists(execCommand, commandFilePath);
   
           //build process
           buildProcess(commandFilePath);
   
           // parse process output
           parseProcessOutput(process);
   
   
           Integer processId = getProcessId(process);
   
           result.setProcessId(processId);
   
           // cache processId
           taskExecutionContext.setProcessId(processId);
           taskExecutionContextCacheManager.cacheTaskExecutionContext(taskExecutionContext);
   
           // print process id
           logger.info("process start, process id is: {}", processId);
   
           // if timeout occurs, exit directly
           long remainTime = getRemaintime();
   
           // waiting for the run to finish
           boolean status = process.waitFor(remainTime, TimeUnit.SECONDS);
   
   
           logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{}",
                   taskExecutionContext.getExecutePath(),
                   processId
                   , result.getExitStatusCode());
   
           // 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 : {} , ready to kill ...", result.getExitStatusCode());
               ProcessUtils.kill(taskExecutionContext);
               result.setExitStatusCode(EXIT_CODE_FAILURE);
           }
   
   
           return result;
       }

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-dolphinscheduler] xingchun-chen closed issue #2407: how does ds check if a process failed ?

Posted by GitBox <gi...@apache.org>.
xingchun-chen closed issue #2407:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/2407


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org