Java Code Examples for org.apache.kylin.job.JobInstance#JobStep

The following examples show how to use org.apache.kylin.job.JobInstance#JobStep . 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 JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
    Preconditions.checkNotNull(stepOutput);
    JobInstance.JobStep result = new JobInstance.JobStep();
    result.setId(task.getId());
    result.setName(task.getName());
    result.setSequenceID(i);
    result.setStatus(parseToJobStepStatus(stepOutput.getState()));
    for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            result.putInfo(entry.getKey(), entry.getValue());
        }
    }
    result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
    result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
    if (task instanceof ShellExecutable) {
        result.setExecCmd(((ShellExecutable) task).getCmd());
    }
    if (task instanceof MapReduceExecutable) {
        result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
        result.setExecWaitTime(AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    }
    if (task instanceof HadoopShellExecutable) {
        result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
    }
    return result;
}
 
Example 2
Source File: JobInstanceExtractor.java    From kylin with Apache License 2.0 6 votes vote down vote up
private JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
    Preconditions.checkNotNull(stepOutput);
    JobInstance.JobStep result = new JobInstance.JobStep();
    result.setId(task.getId());
    result.setName(task.getName());
    result.setSequenceID(i);
    result.setStatus(parseToJobStepStatus(stepOutput.getState()));
    for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            result.putInfo(entry.getKey(), entry.getValue());
        }
    }
    result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
    result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
    if (task instanceof ShellExecutable) {
        result.setExecCmd(((ShellExecutable) task).getCmd());
    }
    if (task instanceof MapReduceExecutable) {
        result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
        result.setExecWaitTime(AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L) / 1000);
    }
    if (task instanceof HadoopShellExecutable) {
        result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
    }
    return result;
}
 
Example 3
Source File: JobService.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i) {
    JobInstance.JobStep result = new JobInstance.JobStep();
    result.setId(task.getId());
    result.setName(task.getName());
    result.setSequenceID(i);
    result.setStatus(parseToJobStepStatus(task.getStatus()));
    final Output output = getExecutableManager().getOutput(task.getId());
    for (Map.Entry<String, String> entry : output.getExtra().entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            result.putInfo(entry.getKey(), entry.getValue());
        }
    }
    result.setExecStartTime(task.getStartTime());
    result.setExecEndTime(task.getEndTime());
    if (task instanceof ShellExecutable) {
        result.setExecCmd(((ShellExecutable) task).getCmd());
    }
    if (task instanceof MapReduceExecutable) {
        result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
        result.setExecWaitTime(((MapReduceExecutable) task).getMapReduceWaitTime() / 1000);
    }
    if (task instanceof HadoopShellExecutable) {
        result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
    }
    return result;
}
 
Example 4
Source File: JobInfoConverter.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
    JobInstance.JobStep result = new JobInstance.JobStep();
    result.setId(task.getId());
    result.setName(task.getName());
    result.setSequenceID(i);

    if (stepOutput == null) {
        logger.warn("Cannot found output for task: id={}", task.getId());
        return result;
    }

    result.setStatus(parseToJobStepStatus(stepOutput.getState()));
    for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            result.putInfo(entry.getKey(), entry.getValue());
        }
    }
    result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
    result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
    if (task instanceof ShellExecutable) {
        result.setExecCmd(((ShellExecutable) task).getCmd());
    }
    if (task instanceof MapReduceExecutable) {
        result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
        result.setExecWaitTime(
                AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L)
                        / 1000);
    }
    if (task instanceof HadoopShellExecutable) {
        result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
    }
    return result;
}
 
Example 5
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStep() {
    TestJob task = new TestJob();
    JobInstance.JobStep step = JobInfoConverter.parseToJobStep(task, 0, null);
    assertEquals(step.getStatus(), JobStepStatusEnum.PENDING);

    step = JobInfoConverter.parseToJobStep(task, 0, new TestOutput());
    assertEquals(step.getStatus(), JobStepStatusEnum.FINISHED);
}
 
Example 6
Source File: JobInfoConverter.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput) {
    JobInstance.JobStep result = new JobInstance.JobStep();
    result.setId(task.getId());
    result.setName(task.getName());
    result.setSequenceID(i);

    if (stepOutput == null) {
        logger.warn("Cannot found output for task: id={}", task.getId());
        return result;
    }

    result.setStatus(parseToJobStepStatus(stepOutput.getState()));
    for (Map.Entry<String, String> entry : stepOutput.getExtra().entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            result.putInfo(entry.getKey(), entry.getValue());
        }
    }
    result.setExecStartTime(AbstractExecutable.getStartTime(stepOutput));
    result.setExecEndTime(AbstractExecutable.getEndTime(stepOutput));
    if (task instanceof ShellExecutable) {
        result.setExecCmd(((ShellExecutable) task).getCmd());
    }
    if (task instanceof MapReduceExecutable) {
        result.setExecCmd(((MapReduceExecutable) task).getMapReduceParams());
        result.setExecWaitTime(
                AbstractExecutable.getExtraInfoAsLong(stepOutput, MapReduceExecutable.MAP_REDUCE_WAIT_TIME, 0L)
                        / 1000);
    }
    if (task instanceof HadoopShellExecutable) {
        result.setExecCmd(((HadoopShellExecutable) task).getJobParams());
    }
    return result;
}
 
Example 7
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStep() {
    TestJob task = new TestJob();
    JobInstance.JobStep step = JobInfoConverter.parseToJobStep(task, 0, null);
    assertEquals(step.getStatus(), JobStepStatusEnum.PENDING);

    step = JobInfoConverter.parseToJobStep(task, 0, new TestOutput());
    assertEquals(step.getStatus(), JobStepStatusEnum.FINISHED);
}