Java Code Examples for org.apache.kylin.cube.CubeInstance#setCuboidLastOptimized()

The following examples show how to use org.apache.kylin.cube.CubeInstance#setCuboidLastOptimized() . 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: CheckpointExecutable.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onExecuteFinished(ExecuteResult result, ExecutableContext executableContext) {
    super.onExecuteFinished(result, executableContext);
    if (!isDiscarded() && result.succeed()) {
        List<? extends Executable> jobs = getTasks();
        boolean allSucceed = true;
        for (Executable task : jobs) {
            final ExecutableState status = task.getStatus();
            if (status != ExecutableState.SUCCEED) {
                allSucceed = false;
            }
        }
        if (allSucceed) {
            // Add last optimization time
            CubeManager cubeManager = CubeManager.getInstance(executableContext.getConfig());
            CubeInstance cube = cubeManager.getCube(getCubeName());
            CubeInstance copyForWrite = cube.latestCopyForWrite();
            try {
                copyForWrite.setCuboidLastOptimized(getEndTime());
                CubeUpdate cubeUpdate = new CubeUpdate(copyForWrite);
                cubeManager.updateCube(cubeUpdate);
            } catch (IOException e) {
                logger.error("Failed to update last optimized for " + getCubeName(), e);
            }
        }
    }
}
 
Example 2
Source File: CheckpointExecutable.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
protected void onExecuteFinished(ExecuteResult result, ExecutableContext executableContext) {
    super.onExecuteFinished(result, executableContext);
    if (!isDiscarded() && result.succeed()) {
        List<? extends Executable> jobs = getTasks();
        boolean allSucceed = true;
        for (Executable task : jobs) {
            final ExecutableState status = task.getStatus();
            if (status != ExecutableState.SUCCEED) {
                allSucceed = false;
            }
        }
        if (allSucceed) {
            // Add last optimization time
            CubeManager cubeManager = CubeManager.getInstance(executableContext.getConfig());
            CubeInstance cube = cubeManager.getCube(getCubeName());
            CubeInstance copyForWrite = cube.latestCopyForWrite();
            try {
                copyForWrite.setCuboidLastOptimized(getEndTime());
                CubeUpdate cubeUpdate = new CubeUpdate(copyForWrite);
                cubeManager.updateCube(cubeUpdate);
            } catch (IOException e) {
                logger.error("Failed to update last optimized for " + getCubeName(), e);
            }
        }
    }
}