Java Code Examples for org.apache.kylin.job.execution.ExecutableState#STOPPED

The following examples show how to use org.apache.kylin.job.execution.ExecutableState#STOPPED . 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: FetcherRunner.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
protected void jobStateCount(String id) {
    final Output outputDigest = getExecutableManager().getOutputDigest(id);
    // logger.debug("Job id:" + id + " not runnable");
    if (outputDigest.getState() == ExecutableState.SUCCEED) {
        succeedJobs.add(id);
        nSUCCEED++;
    } else if (outputDigest.getState() == ExecutableState.ERROR) {
        nError++;
    } else if (outputDigest.getState() == ExecutableState.DISCARDED) {
        nDiscarded++;
    } else if (outputDigest.getState() == ExecutableState.STOPPED) {
        nStopped++;
    } else {
        if (fetchFailed) {
            getExecutableManager().forceKillJob(id);
            nError++;
        } else {
            nOthers++;
        }
    }
}
 
Example 2
Source File: JobService.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
private ExecutableState parseToExecutableState(JobStatusEnum status) {
    Message msg = MsgPicker.getMsg();

    switch (status) {
    case DISCARDED:
        return ExecutableState.DISCARDED;
    case ERROR:
        return ExecutableState.ERROR;
    case FINISHED:
        return ExecutableState.SUCCEED;
    case NEW:
        return ExecutableState.READY;
    case PENDING:
        return ExecutableState.READY;
    case RUNNING:
        return ExecutableState.RUNNING;
    case STOPPED:
        return ExecutableState.STOPPED;
    default:
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_EXECUTABLE_STATE(), status));
    }
}
 
Example 3
Source File: FetcherRunner.java    From kylin with Apache License 2.0 6 votes vote down vote up
protected void jobStateCount(String id) {
    final Output outputDigest = getExecutableManager().getOutputDigest(id);
    // logger.debug("Job id:" + id + " not runnable");
    if (outputDigest.getState() == ExecutableState.SUCCEED) {
        succeedJobs.add(id);
        nSUCCEED++;
    } else if (outputDigest.getState() == ExecutableState.ERROR) {
        nError++;
    } else if (outputDigest.getState() == ExecutableState.DISCARDED) {
        nDiscarded++;
    } else if (outputDigest.getState() == ExecutableState.STOPPED) {
        nStopped++;
    } else {
        if (fetchFailed) {
            getExecutableManager().forceKillJob(id);
            nError++;
        } else {
            nOthers++;
        }
    }
}
 
Example 4
Source File: JobService.java    From kylin with Apache License 2.0 6 votes vote down vote up
private ExecutableState parseToExecutableState(JobStatusEnum status) {
    Message msg = MsgPicker.getMsg();

    switch (status) {
    case DISCARDED:
        return ExecutableState.DISCARDED;
    case ERROR:
        return ExecutableState.ERROR;
    case FINISHED:
        return ExecutableState.SUCCEED;
    case NEW:
        return ExecutableState.READY;
    case PENDING:
        return ExecutableState.READY;
    case RUNNING:
        return ExecutableState.RUNNING;
    case STOPPED:
        return ExecutableState.STOPPED;
    default:
        throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_EXECUTABLE_STATE(), status));
    }
}
 
Example 5
Source File: BaseTestDistributedScheduler.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
void waitForJobFinish(String jobId) {
    while (true) {
        AbstractExecutable job = execMgr.getJob(jobId);
        final ExecutableState status = job.getStatus();
        if (status == ExecutableState.SUCCEED || status == ExecutableState.ERROR || status == ExecutableState.STOPPED || status == ExecutableState.DISCARDED) {
            break;
        } else {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 6
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 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 7
Source File: JobInfoConverterTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusStopped() {
    ExecutableState executableState = ExecutableState.STOPPED;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(32, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.STOPPED, jobStatusEnum);
}
 
Example 8
Source File: BaseSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected void waitForJobFinish(String jobId, int maxWaitTime) {
    int error = 0;
    long start = System.currentTimeMillis();
    final int errorLimit = 3;
    while (error < errorLimit && (System.currentTimeMillis() - start < maxWaitTime)) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        try {
            AbstractExecutable job = execMgr.getJob(jobId);
            ExecutableState status = job.getStatus();
            if (status == ExecutableState.SUCCEED || status == ExecutableState.ERROR
                    || status == ExecutableState.STOPPED || status == ExecutableState.DISCARDED) {
                break;
            }
        } catch (Exception ex) {
            logger.error("", ex);
            error++;
        }
    }

    if (error >= errorLimit) {
        throw new RuntimeException("too many exceptions");
    }

    if (System.currentTimeMillis() - start >= maxWaitTime) {
        throw new RuntimeException("too long wait time");
    }
}
 
Example 9
Source File: BaseTestDistributedScheduler.java    From kylin with Apache License 2.0 5 votes vote down vote up
void waitForJobFinish(String jobId) {
    while (true) {
        AbstractExecutable job = execMgr.getJob(jobId);
        final ExecutableState status = job.getStatus();
        if (status == ExecutableState.SUCCEED || status == ExecutableState.ERROR || status == ExecutableState.STOPPED || status == ExecutableState.DISCARDED) {
            break;
        } else {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 10
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 11
Source File: JobInfoConverterTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusStopped() {
    ExecutableState executableState = ExecutableState.STOPPED;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(32, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.STOPPED, jobStatusEnum);
}
 
Example 12
Source File: BaseSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJobFinish(String jobId, int maxWaitTime) {
    int error = 0;
    long start = System.currentTimeMillis();
    final int errorLimit = 3;
    while (error < errorLimit && (System.currentTimeMillis() - start < maxWaitTime)) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        try {
            AbstractExecutable job = execMgr.getJob(jobId);
            ExecutableState status = job.getStatus();
            if (status == ExecutableState.SUCCEED || status == ExecutableState.ERROR
                    || status == ExecutableState.STOPPED || status == ExecutableState.DISCARDED) {
                break;
            }
        } catch (Exception ex) {
            logger.error("", ex);
            error++;
        }
    }

    if (error >= errorLimit) {
        throw new RuntimeException("too many exceptions");
    }

    if (System.currentTimeMillis() - start >= maxWaitTime) {
        throw new RuntimeException("too long wait time");
    }
}
 
Example 13
Source File: BaseSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJobFinish(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        final ExecutableState status = job.getStatus();
        if (status == ExecutableState.SUCCEED || status == ExecutableState.ERROR || status == ExecutableState.STOPPED || status == ExecutableState.DISCARDED) {
            break;
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 14
Source File: CubeService.java    From Kylin with Apache License 2.0 5 votes vote down vote up
/**
 * purge the cube
 *
 * @throws IOException
 * @throws JobException
 * @throws CubeIntegrityException
 */
private void releaseAllSegments(CubeInstance cube) throws IOException, JobException {
    final List<CubingJob> cubingJobs = listAllCubingJobs(cube.getName(), null);
    for (CubingJob cubingJob : cubingJobs) {
        final ExecutableState status = cubingJob.getStatus();
        if (status != ExecutableState.SUCCEED && status != ExecutableState.STOPPED && status != ExecutableState.DISCARDED) {
            getExecutableManager().discardJob(cubingJob.getId());
        }
    }
    cube.getSegments().clear();
    CubeManager.getInstance(getConfig()).updateCube(cube);
}