Java Code Examples for org.apache.kylin.metadata.project.ProjectInstance#containsRealization()

The following examples show how to use org.apache.kylin.metadata.project.ProjectInstance#containsRealization() . 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: JobInstanceExtractor.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private List<JobInstance> listJobInstances(String project, String cube, long startTime, long endTime) {
    final List<JobInstance> result = Lists.newArrayList();
    final List<AbstractExecutable> executables = executableManager.getAllExecutables(startTime, endTime);
    final Map<String, Output> allOutputs = executableManager.getAllOutputs();
    for (AbstractExecutable executable : executables) {
        if (executable instanceof CubingJob) {
            String cubeName = CubingExecutableUtil.getCubeName(executable.getParams());
            boolean shouldExtract = false;
            if (cube == null || cube.equalsIgnoreCase(cubeName)) {
                if (project == null) {
                    shouldExtract = true;
                } else {
                    ProjectInstance projectInstance = projectManager.getProject(project);
                    if (projectInstance != null && projectInstance.containsRealization(RealizationType.CUBE, cubeName)) {
                        shouldExtract = true;
                    }
                }
            }

            if (shouldExtract) {
                result.add(parseToJobInstance((CubingJob) executable, allOutputs));
            }
        }
    }
    return result;
}
 
Example 2
Source File: JobInstanceExtractor.java    From kylin with Apache License 2.0 6 votes vote down vote up
private List<JobInstance> listJobInstances(String project, String cube, long startTime, long endTime) {
    final List<JobInstance> result = Lists.newArrayList();
    final List<AbstractExecutable> executables = executableManager.getAllExecutables(startTime, endTime);
    final Map<String, Output> allOutputs = executableManager.getAllOutputs();
    for (AbstractExecutable executable : executables) {
        if (executable instanceof CubingJob) {
            String cubeName = CubingExecutableUtil.getCubeName(executable.getParams());
            boolean shouldExtract = false;
            if (cube == null || cube.equalsIgnoreCase(cubeName)) {
                if (project == null) {
                    shouldExtract = true;
                } else {
                    ProjectInstance projectInstance = projectManager.getProject(project);
                    if (projectInstance != null && projectInstance.containsRealization(RealizationType.CUBE, cubeName)) {
                        shouldExtract = true;
                    }
                }
            }

            if (shouldExtract) {
                result.add(parseToJobInstance((CubingJob) executable, allOutputs));
            }
        }
    }
    return result;
}
 
Example 3
Source File: ProjectService.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public String getProjectOfCube(String cubeName) {
    for (ProjectInstance p : getProjectManager().listAllProjects()) {
        if (p.containsRealization(RealizationType.CUBE, cubeName))
            return p.getName();
    }
    return null;
}
 
Example 4
Source File: ProjectService.java    From kylin with Apache License 2.0 5 votes vote down vote up
public String getProjectOfCube(String cubeName) {
    for (ProjectInstance p : getProjectManager().listAllProjects()) {
        if (p.containsRealization(RealizationType.CUBE, cubeName))
            return p.getName();
    }
    return null;
}