Java Code Examples for org.apache.kylin.job.JobInstance#setExecEndTime()

The following examples show how to use org.apache.kylin.job.JobInstance#setExecEndTime() . 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 5 votes vote down vote up
private JobInstance parseToJobInstance(CubingJob cubeJob, Map<String, Output> outputs) {
    CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv())
            .getCube(CubingExecutableUtil.getCubeName(cubeJob.getParams()));

    Output output = outputs.get(cubeJob.getId());
    final JobInstance result = new JobInstance();
    result.setName(cubeJob.getName());
    result.setProjectName(cubeJob.getProjectName());
    if (cube != null) {
        result.setRelatedCube(cube.getName());
        result.setDisplayCubeName(cube.getDisplayName());
    } else {
        String cubeName = CubingExecutableUtil.getCubeName(cubeJob.getParams());
        result.setRelatedCube(cubeName);
        result.setDisplayCubeName(cubeName);
    }
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(cubeJob.getSubmitter());
    result.setUuid(cubeJob.getId());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(AbstractExecutable.getStartTime(output), AbstractExecutable.getEndTime(output), AbstractExecutable.getInterruptTime(output)) / 1000);
    for (int i = 0; i < cubeJob.getTasks().size(); ++i) {
        AbstractExecutable task = cubeJob.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 2
Source File: JobInfoConverter.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static JobInstance parseToJobInstance(CheckpointExecutable job, Map<String, Output> outputs) {
    if (job == null) {
        logger.warn("job is null.");
        return null;
    }

    Output output = outputs.get(job.getId());
    if (output == null) {
        logger.warn("job output is null.");
        return null;
    }

    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(job.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setType(CubeBuildTypeEnum.CHECKPOINT);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(result.getExecStartTime(), result.getExecEndTime(),
            result.getExecInterruptTime()) / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 3
Source File: JobService.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected JobInstance getLookupSnapshotBuildJobInstance(LookupSnapshotBuildJob job) {
    if (job == null) {
        return null;
    }
    Output output = job.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(job.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(job.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(job.getParams()));
    result.setLastModified(job.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setExecStartTime(job.getStartTime());
    result.setExecEndTime(job.getEndTime());
    result.setExecInterruptTime(job.getInterruptTime());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(job.getDuration() / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}
 
Example 4
Source File: JobService.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected JobInstance getCheckpointJobInstance(AbstractExecutable job) {
    Message msg = MsgPicker.getMsg();

    if (job == null) {
        return null;
    }
    if (!(job instanceof CheckpointExecutable)) {
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_JOB_TYPE(), job.getId()));
    }

    CheckpointExecutable checkpointExecutable = (CheckpointExecutable) job;
    Output output = checkpointExecutable.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(checkpointExecutable.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setLastModified(job.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setExecStartTime(job.getStartTime());
    result.setExecEndTime(job.getEndTime());
    result.setExecInterruptTime(job.getInterruptTime());
    result.setType(CubeBuildTypeEnum.CHECKPOINT);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(job.getDuration() / 1000);
    for (int i = 0; i < checkpointExecutable.getTasks().size(); ++i) {
        AbstractExecutable task = checkpointExecutable.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}
 
Example 5
Source File: JobInstanceExtractor.java    From kylin with Apache License 2.0 5 votes vote down vote up
private JobInstance parseToJobInstance(CubingJob cubeJob, Map<String, Output> outputs) {
    CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv())
            .getCube(CubingExecutableUtil.getCubeName(cubeJob.getParams()));

    Output output = outputs.get(cubeJob.getId());
    final JobInstance result = new JobInstance();
    result.setName(cubeJob.getName());
    result.setProjectName(cubeJob.getProjectName());
    if (cube != null) {
        result.setRelatedCube(cube.getName());
        result.setDisplayCubeName(cube.getDisplayName());
    } else {
        String cubeName = CubingExecutableUtil.getCubeName(cubeJob.getParams());
        result.setRelatedCube(cubeName);
        result.setDisplayCubeName(cubeName);
    }
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(cubeJob.getSubmitter());
    result.setUuid(cubeJob.getId());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(AbstractExecutable.getStartTime(output), AbstractExecutable.getEndTime(output), AbstractExecutable.getInterruptTime(output)) / 1000);
    for (int i = 0; i < cubeJob.getTasks().size(); ++i) {
        AbstractExecutable task = cubeJob.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 6
Source File: JobInfoConverter.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static JobInstance parseToJobInstance(CheckpointExecutable job, Map<String, Output> outputs) {
    if (job == null) {
        logger.warn("job is null.");
        return null;
    }

    Output output = outputs.get(job.getId());
    if (output == null) {
        logger.warn("job output is null.");
        return null;
    }

    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(job.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setType(CubeBuildTypeEnum.CHECKPOINT);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(result.getExecStartTime(), result.getExecEndTime(),
            result.getExecInterruptTime()) / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 7
Source File: JobService.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected JobInstance getLookupSnapshotBuildJobInstance(LookupSnapshotBuildJob job) {
    if (job == null) {
        return null;
    }
    Output output = job.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(job.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(job.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(job.getParams()));
    result.setLastModified(job.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setExecStartTime(job.getStartTime());
    result.setExecEndTime(job.getEndTime());
    result.setExecInterruptTime(job.getInterruptTime());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(job.getDuration() / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}
 
Example 8
Source File: JobService.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected JobInstance getCheckpointJobInstance(AbstractExecutable job) {
    Message msg = MsgPicker.getMsg();

    if (job == null) {
        return null;
    }
    if (!(job instanceof CheckpointExecutable)) {
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_JOB_TYPE(), job.getId()));
    }

    CheckpointExecutable checkpointExecutable = (CheckpointExecutable) job;
    Output output = checkpointExecutable.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(checkpointExecutable.getProjectName());
    result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams()));
    result.setLastModified(job.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setExecStartTime(job.getStartTime());
    result.setExecEndTime(job.getEndTime());
    result.setExecInterruptTime(job.getInterruptTime());
    result.setType(CubeBuildTypeEnum.CHECKPOINT);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(job.getDuration() / 1000);
    for (int i = 0; i < checkpointExecutable.getTasks().size(); ++i) {
        AbstractExecutable task = checkpointExecutable.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}
 
Example 9
Source File: JobInfoConverter.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
public static JobInstance parseToJobInstance(CubingJob job, Map<String, Output> outputs) {
    if (job == null) {
        logger.warn("job is null.");
        return null;
    }

    Output output = outputs.get(job.getId());
    if (output == null) {
        logger.warn("job output is null.");
        return null;
    }

    CubingJob cubeJob = (CubingJob) job;
    CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv())
            .getCube(CubingExecutableUtil.getCubeName(cubeJob.getParams()));

    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(cubeJob.getProjectName());
    result.setRelatedCube(cube != null ? cube.getName() : CubingExecutableUtil.getCubeName(cubeJob.getParams()));
    result.setDisplayCubeName(cube != null ? cube.getDisplayName() : CubingExecutableUtil.getCubeName(cubeJob.getParams()));
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(result.getExecStartTime(), result.getExecEndTime(),
            result.getExecInterruptTime()) / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 10
Source File: JobService.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
protected JobInstance getSingleJobInstance(AbstractExecutable job) {
    Message msg = MsgPicker.getMsg();

    if (job == null) {
        return null;
    }

    DefaultChainedExecutable cubeJob;

    if (job instanceof CubingJob) {
        cubeJob = (CubingJob) job;
    } else {
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_JOB_TYPE(), job.getId()));
    }

    CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv())
            .getCube(CubingExecutableUtil.getCubeName(cubeJob.getParams()));
    Output output = cubeJob.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(cubeJob.getProjectName());
    if (cube != null) {
        result.setRelatedCube(cube.getName());
        result.setDisplayCubeName(cube.getDisplayName());
    } else {
        String cubeName = CubingExecutableUtil.getCubeName(cubeJob.getParams());
        result.setRelatedCube(cubeName);
        result.setDisplayCubeName(cubeName);
    }
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(cubeJob.getLastModified());
    result.setSubmitter(cubeJob.getSubmitter());
    result.setUuid(cubeJob.getId());
    result.setExecStartTime(cubeJob.getStartTime());
    result.setExecEndTime(cubeJob.getEndTime());
    result.setExecInterruptTime(cubeJob.getInterruptTime());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setMrWaiting(cubeJob.getMapReduceWaitTime() / 1000);
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(cubeJob.getDuration() / 1000);
    for (int i = 0; i < cubeJob.getTasks().size(); ++i) {
        AbstractExecutable task = cubeJob.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}
 
Example 11
Source File: JobInfoConverter.java    From kylin with Apache License 2.0 4 votes vote down vote up
public static JobInstance parseToJobInstance(CubingJob job, Map<String, Output> outputs) {
    if (job == null) {
        logger.warn("job is null.");
        return null;
    }

    Output output = outputs.get(job.getId());
    if (output == null) {
        logger.warn("job output is null.");
        return null;
    }

    CubingJob cubeJob = job;
    String cubeName = CubingExecutableUtil.getCubeName(cubeJob.getParams());
    String displayCubeName = cubeName;
    try {
        CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv()).getCube(cubeName);
        if (cube != null) {
            cubeName = cube.getName();
            displayCubeName = cube.getDisplayName();
        }
    } catch (Exception e) {
        logger.warn("Fail to get cube instance for {}.", cubeName);
    }

    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(cubeJob.getProjectName());
    result.setRelatedCube(cubeName);
    result.setDisplayCubeName(displayCubeName);
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(output.getLastModified());
    result.setSubmitter(job.getSubmitter());
    result.setUuid(job.getId());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(parseToJobStatus(output.getState()));
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setMrWaiting(AbstractExecutable.getExtraInfoAsLong(output, CubingJob.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    result.setExecStartTime(AbstractExecutable.getStartTime(output));
    result.setExecEndTime(AbstractExecutable.getEndTime(output));
    result.setExecInterruptTime(AbstractExecutable.getInterruptTime(output));
    result.setDuration(AbstractExecutable.getDuration(result.getExecStartTime(), result.getExecEndTime(),
            result.getExecInterruptTime()) / 1000);
    for (int i = 0; i < job.getTasks().size(); ++i) {
        AbstractExecutable task = job.getTasks().get(i);
        result.addStep(parseToJobStep(task, i, outputs.get(task.getId())));
    }
    return result;
}
 
Example 12
Source File: JobService.java    From kylin with Apache License 2.0 4 votes vote down vote up
protected JobInstance getSingleJobInstance(AbstractExecutable job) {
    Message msg = MsgPicker.getMsg();

    if (job == null) {
        return null;
    }
    if (!(job instanceof CubingJob)) {
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_JOB_TYPE(), job.getId()));
    }

    CubingJob cubeJob = (CubingJob) job;
    CubeInstance cube = CubeManager.getInstance(KylinConfig.getInstanceFromEnv())
            .getCube(CubingExecutableUtil.getCubeName(cubeJob.getParams()));
    Output output = cubeJob.getOutput();
    final JobInstance result = new JobInstance();
    result.setName(job.getName());
    result.setProjectName(cubeJob.getProjectName());
    if (cube != null) {
        result.setRelatedCube(cube.getName());
        result.setDisplayCubeName(cube.getDisplayName());
    } else {
        String cubeName = CubingExecutableUtil.getCubeName(cubeJob.getParams());
        result.setRelatedCube(cubeName);
        result.setDisplayCubeName(cubeName);
    }
    result.setRelatedSegment(CubingExecutableUtil.getSegmentId(cubeJob.getParams()));
    result.setRelatedSegmentName(CubingExecutableUtil.getSegmentName(cubeJob.getParams()));
    result.setLastModified(cubeJob.getLastModified());
    result.setSubmitter(cubeJob.getSubmitter());
    result.setUuid(cubeJob.getId());
    result.setExecStartTime(cubeJob.getStartTime());
    result.setExecEndTime(cubeJob.getEndTime());
    result.setExecInterruptTime(cubeJob.getInterruptTime());
    result.setType(CubeBuildTypeEnum.BUILD);
    result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus()));
    result.setMrWaiting(cubeJob.getMapReduceWaitTime() / 1000);
    result.setBuildInstance(AbstractExecutable.getBuildInstance(output));
    result.setDuration(cubeJob.getDuration() / 1000);
    for (int i = 0; i < cubeJob.getTasks().size(); ++i) {
        AbstractExecutable task = cubeJob.getTasks().get(i);
        result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId())));
    }
    return result;
}