Search in sources :

Example 21 with Application

use of com.webank.wedatasphere.qualitis.entity.Application in project Qualitis by WeBankFinTech.

the class OuterExecutionServiceImpl method generateAbnormalApplicationInfo.

private void generateAbnormalApplicationInfo(Long projectId, Long ruleGroupId, String createUser, String executionUser, Date date, Integer invokeCode, String partition, String startupParams, String executionParams, Exception e, Integer applicationCommentCode, Integer applicationStatusCode, List<Rule> rules) {
    Application newApplication = outerExecutionService.generateApplicationInfo(createUser, executionUser, date, invokeCode);
    newApplication.setPartition(partition);
    newApplication.setProjectId(projectId);
    newApplication.setRuleGroupId(ruleGroupId);
    newApplication.setStartupParam(startupParams);
    newApplication.setExecutionParam(executionParams);
    catchAndSolve(e, applicationCommentCode, applicationStatusCode, rules, newApplication);
}
Also used : Application(com.webank.wedatasphere.qualitis.entity.Application)

Example 22 with Application

use of com.webank.wedatasphere.qualitis.entity.Application in project Qualitis by WeBankFinTech.

the class TaskChecker method writeDb.

private void writeDb(JobChecker jobChecker, String newStatus, Integer errCode) {
    Task taskInDb = taskDao.findByRemoteTaskIdAndClusterName(jobChecker.getTaskId(), jobChecker.getClusterName());
    Application applicationInDb = applicationDao.findById(jobChecker.getApplicationId());
    if (newStatus.equals(TaskStatusEnum.FAILED.getState())) {
        /*
             * 1.Modify end time of job
             * 2.Modify task finish time and failed num if last job
             * */
        taskInDb.setEndTime(new DateTime(new Date()).toString(PRINT_TIME_FORMAT));
        taskInDb.setTaskComment(errCode == null ? ApplicationCommentEnum.UNKNOWN_ERROR_ISSUES.getCode() : ERR_CODE_TYPE.get(errCode));
        modifyJobStatus(taskInDb, newStatus);
        taskDao.save(taskInDb);
        applicationInDb.setApplicationComment(errCode == null ? ApplicationCommentEnum.UNKNOWN_ERROR_ISSUES.getCode() : ERR_CODE_TYPE.get(errCode));
        checkIfLastJob(applicationInDb, false, false, false);
    } else if (newStatus.equals(TaskStatusEnum.SUCCEED.getState())) {
        /*
             * 1.Modify end time of job
             * 2.Modify task finish time and succeed num if last job
             * */
        taskInDb.setEndTime(new DateTime(new Date()).toString(PRINT_TIME_FORMAT));
        boolean isPass;
        boolean finish;
        if (passCheckOut(jobChecker.getApplicationId(), taskInDb)) {
            modifyJobStatus(taskInDb, TaskStatusEnum.PASS_CHECKOUT.getState());
            isPass = true;
            finish = true;
        } else {
            if (taskInDb.getAbortOnFailure() != null && taskInDb.getAbortOnFailure()) {
                modifyJobStatus(taskInDb, TaskStatusEnum.FAILED.getState());
                taskInDb.setTaskComment(ApplicationCommentEnum.DIFF_DATA_ISSUES.getCode());
                applicationInDb.setApplicationComment(ApplicationCommentEnum.DIFF_DATA_ISSUES.getCode());
                finish = false;
            } else {
                modifyJobStatus(taskInDb, TaskStatusEnum.FAIL_CHECKOUT.getState());
                finish = true;
            }
            isPass = false;
        }
        taskDao.save(taskInDb);
        checkIfLastJob(applicationInDb, finish, isPass, false);
    } else if (newStatus.equals(TaskStatusEnum.CANCELLED.getState())) {
        modifyJobStatus(taskInDb, newStatus);
        taskDao.save(taskInDb);
        applicationInDb.setApplicationComment(ApplicationCommentEnum.TIMEOUT_KILL.getCode());
        checkIfLastJob(applicationInDb, false, false, false);
    } else {
        modifyJobStatus(taskInDb, newStatus);
        taskDao.save(taskInDb);
    }
}
Also used : Task(com.webank.wedatasphere.qualitis.entity.Task) Application(com.webank.wedatasphere.qualitis.entity.Application) DateTime(org.joda.time.DateTime) Date(java.util.Date)

Aggregations

Application (com.webank.wedatasphere.qualitis.entity.Application)22 Task (com.webank.wedatasphere.qualitis.entity.Task)15 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)14 ArrayList (java.util.ArrayList)13 UnExpectedRequestException (com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException)10 Date (java.util.Date)9 TaskRuleSimple (com.webank.wedatasphere.qualitis.entity.TaskRuleSimple)7 HashMap (java.util.HashMap)7 TaskDataSource (com.webank.wedatasphere.qualitis.entity.TaskDataSource)6 TaskRuleAlarmConfig (com.webank.wedatasphere.qualitis.entity.TaskRuleAlarmConfig)6 User (com.webank.wedatasphere.qualitis.entity.User)6 TaskSubmitResult (com.webank.wedatasphere.qualitis.bean.TaskSubmitResult)5 LinkisConfig (com.webank.wedatasphere.qualitis.config.LinkisConfig)5 AlarmConfigStatusEnum (com.webank.wedatasphere.qualitis.constant.AlarmConfigStatusEnum)5 TaskStatusEnum (com.webank.wedatasphere.qualitis.constant.TaskStatusEnum)5 ApplicationDao (com.webank.wedatasphere.qualitis.dao.ApplicationDao)5 ClusterInfoDao (com.webank.wedatasphere.qualitis.dao.ClusterInfoDao)5 TaskDao (com.webank.wedatasphere.qualitis.dao.TaskDao)5 TaskResultDao (com.webank.wedatasphere.qualitis.dao.TaskResultDao)5 ClusterInfo (com.webank.wedatasphere.qualitis.entity.ClusterInfo)5