Java Code Examples for org.apache.kylin.job.dao.ExecutablePO#getType()

The following examples show how to use org.apache.kylin.job.dao.ExecutablePO#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataCleanupJob.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private boolean isJobComplete(ExecutableDao executableDao, ExecutablePO job) {
    String jobId = job.getUuid();
    boolean isComplete = false;
    try {
        ExecutableOutputPO output = executableDao.getJobOutput(jobId);
        String status = output.getStatus();
        String jobType = job.getType();
        if (jobType.equals(CubingJob.class.getName())
                || jobType.equals(CheckpointExecutable.class.getName())) {
            if (StringUtils.equals(status, ExecutableState.SUCCEED.toString())
                    || StringUtils.equals(status, ExecutableState.DISCARDED.toString())) {
                isComplete = true;
            }
        } else if (jobType.equals(CardinalityExecutable.class.getName())) {
            // Ignore state of DefaultChainedExecutable
            isComplete = true;
        }
    } catch (PersistentException e) {
        logger.error("Get job output failed for job uuid: {}", jobId, e);
        isComplete = true; // job output broken --> will be treat as complete
    }

    return isComplete;
}
 
Example 2
Source File: MetadataCleanupJob.java    From kylin with Apache License 2.0 6 votes vote down vote up
private boolean isJobComplete(ExecutableDao executableDao, ExecutablePO job) {
    String jobId = job.getUuid();
    boolean isComplete = false;
    try {
        ExecutableOutputPO output = executableDao.getJobOutput(jobId);
        String status = output.getStatus();
        String jobType = job.getType();
        if (jobType.equals(CubingJob.class.getName())
                || jobType.equals(CheckpointExecutable.class.getName())) {
            if (StringUtils.equals(status, ExecutableState.SUCCEED.toString())
                    || StringUtils.equals(status, ExecutableState.DISCARDED.toString())) {
                isComplete = true;
            }
        } else if (jobType.equals(CardinalityExecutable.class.getName())) {
            // Ignore state of DefaultChainedExecutable
            isComplete = true;
        }
    } catch (PersistentException e) {
        logger.error("Get job output failed for job uuid: {}", jobId, e);
        isComplete = true; // job output broken --> will be treat as complete
    }

    return isComplete;
}
 
Example 3
Source File: ExecutableManager.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private static AbstractExecutable parseTo(ExecutablePO executablePO) {
    if (executablePO == null) {
        return null;
    }
    String type = executablePO.getType();
    try {
        Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class);
        Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor();
        AbstractExecutable result = constructor.newInstance();
        result.setId(executablePO.getUuid());
        result.setName(executablePO.getName());
        result.setParams(executablePO.getParams());
        List<ExecutablePO> tasks = executablePO.getTasks();
        if (tasks != null && !tasks.isEmpty()) {
            Preconditions.checkArgument(result instanceof DefaultChainedExecutable);
            for (ExecutablePO subTask: tasks) {
                ((DefaultChainedExecutable) result).addTask(parseTo(subTask));
            }
        }
        return result;
    } catch (ReflectiveOperationException e) {
        throw new IllegalArgumentException("cannot parse this job:" + executablePO.getId(), e);
    }
}
 
Example 4
Source File: ExecutableManager.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private AbstractExecutable parseTo(ExecutablePO executablePO) {
    if (executablePO == null) {
        logger.warn("executablePO is null");
        return null;
    }
    String type = executablePO.getType();
    AbstractExecutable result = newExecutable(type);
    result.initConfig(config);
    result.setId(executablePO.getUuid());
    result.setName(executablePO.getName());
    result.setParams(executablePO.getParams());
    result.setPriority(executablePO.getPriority());

    if (!(result instanceof BrokenExecutable)) {
        List<ExecutablePO> tasks = executablePO.getTasks();
        if (tasks != null && !tasks.isEmpty()) {
            Preconditions.checkArgument(result instanceof ChainedExecutable);
            for (ExecutablePO subTask : tasks) {
                AbstractExecutable subTaskExecutable = parseTo(subTask);
                if (subTaskExecutable != null) {
                    subTaskExecutable.setParentExecutable(result);
                }
                ((ChainedExecutable) result).addTask(parseTo(subTask));
            }
        }
        List<ExecutablePO> tasksForCheck = executablePO.getTasksForCheck();
        if (tasksForCheck != null && !tasksForCheck.isEmpty()) {
            Preconditions.checkArgument(result instanceof CheckpointExecutable);
            for (ExecutablePO subTaskForCheck : tasksForCheck) {
                ((CheckpointExecutable) result).addTaskForCheck(parseTo(subTaskForCheck));
            }
        }
    }

    return result;
}
 
Example 5
Source File: ExecutableManager.java    From kylin with Apache License 2.0 5 votes vote down vote up
private AbstractExecutable parseTo(ExecutablePO executablePO) {
    if (executablePO == null) {
        logger.warn("executablePO is null");
        return null;
    }
    String type = executablePO.getType();
    AbstractExecutable result = newExecutable(type);
    result.initConfig(config);
    result.setId(executablePO.getUuid());
    result.setName(executablePO.getName());
    result.setParams(executablePO.getParams());
    result.setPriority(executablePO.getPriority());

    if (!(result instanceof BrokenExecutable)) {
        List<ExecutablePO> tasks = executablePO.getTasks();
        if (tasks != null && !tasks.isEmpty()) {
            Preconditions.checkArgument(result instanceof ChainedExecutable);
            for (ExecutablePO subTask : tasks) {
                AbstractExecutable subTaskExecutable = parseTo(subTask);
                if (subTaskExecutable != null) {
                    subTaskExecutable.setParentExecutable(result);
                }
                ((ChainedExecutable) result).addTask(parseTo(subTask));
            }
        }
        List<ExecutablePO> tasksForCheck = executablePO.getTasksForCheck();
        if (tasksForCheck != null && !tasksForCheck.isEmpty()) {
            Preconditions.checkArgument(result instanceof CheckpointExecutable);
            for (ExecutablePO subTaskForCheck : tasksForCheck) {
                ((CheckpointExecutable) result).addTaskForCheck(parseTo(subTaskForCheck));
            }
        }
    }

    return result;
}