org.apache.kylin.job.constant.JobStepStatusEnum Java Examples

The following examples show how to use org.apache.kylin.job.constant.JobStepStatusEnum. 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: JobInfoConverter.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
public static JobStepStatusEnum parseToJobStepStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStepStatusEnum.PENDING;
    case RUNNING:
        return JobStepStatusEnum.RUNNING;
    case ERROR:
        return JobStepStatusEnum.ERROR;
    case DISCARDED:
        return JobStepStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStepStatusEnum.FINISHED;
    case STOPPED:
        return JobStepStatusEnum.STOPPED;
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example #2
Source File: JobService.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private JobStepStatusEnum parseToJobStepStatus(ExecutableState state) {
    switch (state) {
        case READY:
            return JobStepStatusEnum.PENDING;
        case RUNNING:
            return JobStepStatusEnum.RUNNING;
        case ERROR:
            return JobStepStatusEnum.ERROR;
        case DISCARDED:
            return JobStepStatusEnum.DISCARDED;
        case SUCCEED:
            return JobStepStatusEnum.FINISHED;
        case STOPPED:
        default:
            throw new RuntimeException("invalid state:" + state);
    }
}
 
Example #3
Source File: CubeMetadataUpgrade.java    From Kylin with Apache License 2.0 6 votes vote down vote up
private ExecutableState parseState(JobStepStatusEnum state) {
    switch (state) {
        case NEW:
        case PENDING:
        case WAITING:
            return ExecutableState.READY;
        case RUNNING:
            return ExecutableState.RUNNING;
        case FINISHED:
            return ExecutableState.SUCCEED;
        case ERROR:
            return ExecutableState.ERROR;
        case DISCARDED:
            return ExecutableState.DISCARDED;
        default:
            return ExecutableState.DISCARDED;
    }

}
 
Example #4
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testStatusConvert() {
    assertEquals(JobStatusEnum.PENDING, JobInfoConverter.parseToJobStatus(ExecutableState.READY));
    assertEquals(JobStatusEnum.RUNNING, JobInfoConverter.parseToJobStatus(ExecutableState.RUNNING));
    assertEquals(JobStatusEnum.DISCARDED, JobInfoConverter.parseToJobStatus(ExecutableState.DISCARDED));
    assertEquals(JobStatusEnum.ERROR, JobInfoConverter.parseToJobStatus(ExecutableState.ERROR));
    assertEquals(JobStatusEnum.STOPPED, JobInfoConverter.parseToJobStatus(ExecutableState.STOPPED));
    assertEquals(JobStatusEnum.FINISHED, JobInfoConverter.parseToJobStatus(ExecutableState.SUCCEED));

    assertEquals(JobStepStatusEnum.PENDING, JobInfoConverter.parseToJobStepStatus(ExecutableState.READY));
    assertEquals(JobStepStatusEnum.RUNNING, JobInfoConverter.parseToJobStepStatus(ExecutableState.RUNNING));
    assertEquals(JobStepStatusEnum.DISCARDED, JobInfoConverter.parseToJobStepStatus(ExecutableState.DISCARDED));
    assertEquals(JobStepStatusEnum.ERROR, JobInfoConverter.parseToJobStepStatus(ExecutableState.ERROR));
    assertEquals(JobStepStatusEnum.STOPPED, JobInfoConverter.parseToJobStepStatus(ExecutableState.STOPPED));
    assertEquals(JobStepStatusEnum.FINISHED, JobInfoConverter.parseToJobStepStatus(ExecutableState.SUCCEED));
}
 
Example #5
Source File: JobInfoConverter.java    From kylin with Apache License 2.0 6 votes vote down vote up
public static JobStepStatusEnum parseToJobStepStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStepStatusEnum.PENDING;
    case RUNNING:
        return JobStepStatusEnum.RUNNING;
    case ERROR:
        return JobStepStatusEnum.ERROR;
    case DISCARDED:
        return JobStepStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStepStatusEnum.FINISHED;
    case STOPPED:
        return JobStepStatusEnum.STOPPED;
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example #6
Source File: JobInstanceExtractor.java    From kylin with Apache License 2.0 6 votes vote down vote up
private JobStepStatusEnum parseToJobStepStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStepStatusEnum.PENDING;
    case RUNNING:
        return JobStepStatusEnum.RUNNING;
    case ERROR:
        return JobStepStatusEnum.ERROR;
    case DISCARDED:
        return JobStepStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStepStatusEnum.FINISHED;
    case STOPPED:
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example #7
Source File: JobInstanceExtractor.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private JobStepStatusEnum parseToJobStepStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStepStatusEnum.PENDING;
    case RUNNING:
        return JobStepStatusEnum.RUNNING;
    case ERROR:
        return JobStepStatusEnum.ERROR;
    case DISCARDED:
        return JobStepStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStepStatusEnum.FINISHED;
    case STOPPED:
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example #8
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusPending() {
    ExecutableState executableState = ExecutableState.READY;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isRunable());
    assertEquals(1, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.PENDING, jobStepStatusEnum);
}
 
Example #9
Source File: JobInstance.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@JsonProperty("progress")
public double getProgress() {
    int completedStepCount = 0;
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.FINISHED)) {
            completedStepCount++;
        }
    }

    return 100.0 * completedStepCount / steps.size();
}
 
Example #10
Source File: JobInstance.java    From Kylin with Apache License 2.0 5 votes vote down vote up
public JobStep getRunningStep() {
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.RUNNING) || step.getStatus().equals(JobStepStatusEnum.WAITING)) {
            return step;
        }
    }

    return null;
}
 
Example #11
Source File: HadoopJobStatusChecker.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static JobStepStatusEnum checkStatus(Job job, StringBuilder output) {
    if (job == null || job.getJobID() == null) {
        output.append("Skip status check with empty job id..\n");
        return JobStepStatusEnum.WAITING;
    }

    JobStepStatusEnum status = null;
    try {
        switch (job.getStatus().getState()) {
        case SUCCEEDED:
            status = JobStepStatusEnum.FINISHED;
            break;
        case FAILED:
            status = JobStepStatusEnum.ERROR;
            break;
        case KILLED:
            status = JobStepStatusEnum.KILLED;
            break;
        case RUNNING:
            status = JobStepStatusEnum.RUNNING;
            break;
        case PREP:
            status = JobStepStatusEnum.WAITING;
            break;
        default:
            throw new IllegalStateException();
        }
    } catch (Exception e) {
        logger.error("error check status", e);
        output.append("Exception: ").append(e.getLocalizedMessage()).append("\n");
        status = JobStepStatusEnum.ERROR;
    }

    return status;
}
 
Example #12
Source File: JobInstance.java    From kylin with Apache License 2.0 5 votes vote down vote up
@JsonProperty("progress")
public double getProgress() {
    int completedStepCount = 0;
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.FINISHED)) {
            completedStepCount++;
        }
    }

    return 100.0 * completedStepCount / steps.size();
}
 
Example #13
Source File: JobInstance.java    From kylin with Apache License 2.0 5 votes vote down vote up
public JobStep getRunningStep() {
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.RUNNING)
                || step.getStatus().equals(JobStepStatusEnum.WAITING)) {
            return step;
        }
    }

    return null;
}
 
Example #14
Source File: HadoopJobStatusCheckerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testCheckStatusWithEmptyJobId() throws IOException {
    Job job = Job.getInstance(new Configuration(false));
    StringBuilder stringBuilder = new StringBuilder();
    JobStepStatusEnum jobStepStatusEnum = HadoopJobStatusChecker.checkStatus(job, stringBuilder);

    assertEquals(JobStepStatusEnum.WAITING, jobStepStatusEnum);
    assertEquals("Skip status check with empty job id..\n", stringBuilder.toString());

    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(32, jobStepStatusEnum.getCode());

    assertFalse(jobStepStatusEnum.isComplete());
}
 
Example #15
Source File: HadoopJobStatusCheckerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testCheckStatusWithNullJob() {
    StringBuilder stringBuilder = new StringBuilder();
    JobStepStatusEnum jobStepStatusEnum = HadoopJobStatusChecker.checkStatus(null, stringBuilder);

    assertEquals(JobStepStatusEnum.WAITING, jobStepStatusEnum);
    assertEquals("Skip status check with empty job id..\n", stringBuilder.toString());

    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(32, jobStepStatusEnum.getCode());

    assertFalse(jobStepStatusEnum.isComplete());
}
 
Example #16
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusDiscarded() {
    ExecutableState executableState = ExecutableState.DISCARDED;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isComplete());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(16, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.DISCARDED, jobStepStatusEnum);
}
 
Example #17
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusError() {
    ExecutableState executableState = ExecutableState.ERROR;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isRunable());
    assertTrue(jobStepStatusEnum.isComplete());
    assertEquals(8, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.ERROR, jobStepStatusEnum);
}
 
Example #18
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusRunning() {
    ExecutableState executableState = ExecutableState.RUNNING;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertEquals(2, jobStepStatusEnum.getCode());
    assertFalse(jobStepStatusEnum.isComplete());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(JobStepStatusEnum.RUNNING, jobStepStatusEnum);
}
 
Example #19
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusDiscarded() {
    ExecutableState executableState = ExecutableState.DISCARDED;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isComplete());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(16, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.DISCARDED, jobStepStatusEnum);
}
 
Example #20
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusFinished() {
    ExecutableState executableState = ExecutableState.SUCCEED;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isComplete());
    assertEquals(4, jobStepStatusEnum.getCode());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(JobStepStatusEnum.FINISHED, jobStepStatusEnum);
}
 
Example #21
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusStopped() {
    ExecutableState executableState = ExecutableState.STOPPED;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertFalse(jobStepStatusEnum.isComplete());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(128, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.STOPPED, jobStepStatusEnum);
}
 
Example #22
Source File: HadoopJobStatusCheckerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testCheckStatusWithNullJob() {
    StringBuilder stringBuilder = new StringBuilder();
    JobStepStatusEnum jobStepStatusEnum = HadoopJobStatusChecker.checkStatus(null, stringBuilder);

    assertEquals(JobStepStatusEnum.WAITING, jobStepStatusEnum);
    assertEquals("Skip status check with empty job id..\n", stringBuilder.toString());

    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(32, jobStepStatusEnum.getCode());

    assertFalse(jobStepStatusEnum.isComplete());
}
 
Example #23
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusRunning() {
    ExecutableState executableState = ExecutableState.RUNNING;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertEquals(2, jobStepStatusEnum.getCode());
    assertFalse(jobStepStatusEnum.isComplete());
    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(JobStepStatusEnum.RUNNING, jobStepStatusEnum);
}
 
Example #24
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusError() {
    ExecutableState executableState = ExecutableState.ERROR;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isRunable());
    assertTrue(jobStepStatusEnum.isComplete());
    assertEquals(8, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.ERROR, jobStepStatusEnum);
}
 
Example #25
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStepStatusReturnsJobStepStatusPending() {
    ExecutableState executableState = ExecutableState.READY;
    JobStepStatusEnum jobStepStatusEnum = JobInfoConverter.parseToJobStepStatus(executableState);

    assertTrue(jobStepStatusEnum.isRunable());
    assertEquals(1, jobStepStatusEnum.getCode());
    assertEquals(JobStepStatusEnum.PENDING, jobStepStatusEnum);
}
 
Example #26
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 #27
Source File: HadoopJobStatusCheckerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testCheckStatusWithEmptyJobId() throws IOException {
    Job job = Job.getInstance(new Configuration(false));
    StringBuilder stringBuilder = new StringBuilder();
    JobStepStatusEnum jobStepStatusEnum = HadoopJobStatusChecker.checkStatus(job, stringBuilder);

    assertEquals(JobStepStatusEnum.WAITING, jobStepStatusEnum);
    assertEquals("Skip status check with empty job id..\n", stringBuilder.toString());

    assertFalse(jobStepStatusEnum.isRunable());
    assertEquals(32, jobStepStatusEnum.getCode());

    assertFalse(jobStepStatusEnum.isComplete());
}
 
Example #28
Source File: JobInstance.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public JobStep getRunningStep() {
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.RUNNING)
                || step.getStatus().equals(JobStepStatusEnum.WAITING)) {
            return step;
        }
    }

    return null;
}
 
Example #29
Source File: JobInstance.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@JsonProperty("progress")
public double getProgress() {
    int completedStepCount = 0;
    for (JobStep step : this.getSteps()) {
        if (step.getStatus().equals(JobStepStatusEnum.FINISHED)) {
            completedStepCount++;
        }
    }

    return 100.0 * completedStepCount / steps.size();
}
 
Example #30
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);
}