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);
}
}
Aggregations