Search in sources :

Example 1 with WorkerAccessException

use of com.dtstack.taier.common.exception.WorkerAccessException in project Taier by DTStack.

the class JobSubmitDealer method submitJob.

private void submitJob(JobClient jobClient) {
    JobResult jobResult = null;
    try {
        // 判断资源
        JudgeResult judgeResult = workerOperator.judgeSlots(jobClient);
        if (JudgeResult.JudgeType.OK == judgeResult.getResult()) {
            LOGGER.info("jobId:{} taskType:{} submit to engine start.", jobClient.getJobId(), jobClient.getTaskType());
            jobClient.doStatusCallBack(TaskStatus.COMPUTING.getStatus());
            // 提交任务
            jobResult = workerOperator.submitJob(jobClient);
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("jobId:{} taskType:{} submit jobResult:{}.", jobClient.getJobId(), jobClient.getTaskType(), jobResult);
            }
            jobClient.setEngineTaskId(jobResult.getData(JobResult.EXT_ID_KEY));
            jobClient.setApplicationId(jobResult.getData(JobResult.JOB_ID_KEY));
            addToTaskListener(jobClient, jobResult);
            LOGGER.info("jobId:{} taskType:{} submit to engine end.", jobClient.getJobId(), jobClient.getTaskType());
        } else if (JudgeResult.JudgeType.LIMIT_ERROR == judgeResult.getResult()) {
            LOGGER.info("jobId:{} taskType:{} submitJob happens system limitError:{}", jobClient.getJobId(), jobClient.getTaskType(), judgeResult.getReason());
            jobClient.setEngineTaskId(null);
            jobResult = JobResult.createErrorResult(false, judgeResult.getReason());
            addToTaskListener(jobClient, jobResult);
        } else if (JudgeResult.JudgeType.EXCEPTION == judgeResult.getResult()) {
            LOGGER.info("jobId:{} taskType:{} judgeSlots result is exception {}", jobClient.getJobId(), jobClient.getTaskType(), judgeResult.getReason());
            handlerFailedWithRetry(jobClient, true, new Exception(judgeResult.getReason()));
        } else {
            LOGGER.info("jobId:{} taskType:{} judgeSlots result is false.", jobClient.getJobId(), jobClient.getTaskType());
            handlerNoResource(jobClient, judgeResult);
        }
    } catch (WorkerAccessException e) {
        LOGGER.info(" jobId:{} taskType:{} worker not find.", jobClient.getJobId(), jobClient.getTaskType());
        handlerNoResource(jobClient, workerNotFindResult);
    } catch (ClientAccessException | ClientArgumentException e) {
        handlerFailedWithRetry(jobClient, false, e);
    } catch (Throwable e) {
        handlerFailedWithRetry(jobClient, true, e);
    }
}
Also used : ClientArgumentException(com.dtstack.taier.pluginapi.exception.ClientArgumentException) JobResult(com.dtstack.taier.pluginapi.pojo.JobResult) JudgeResult(com.dtstack.taier.pluginapi.pojo.JudgeResult) ClientAccessException(com.dtstack.taier.common.exception.ClientAccessException) WorkerAccessException(com.dtstack.taier.common.exception.WorkerAccessException) ClientArgumentException(com.dtstack.taier.pluginapi.exception.ClientArgumentException) ClientAccessException(com.dtstack.taier.common.exception.ClientAccessException) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException) WorkerAccessException(com.dtstack.taier.common.exception.WorkerAccessException)

Aggregations

ClientAccessException (com.dtstack.taier.common.exception.ClientAccessException)1 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 WorkerAccessException (com.dtstack.taier.common.exception.WorkerAccessException)1 ClientArgumentException (com.dtstack.taier.pluginapi.exception.ClientArgumentException)1 JobResult (com.dtstack.taier.pluginapi.pojo.JobResult)1 JudgeResult (com.dtstack.taier.pluginapi.pojo.JudgeResult)1