Java Code Examples for org.apache.kylin.job.constant.JobStatusEnum

The following examples show how to use org.apache.kylin.job.constant.JobStatusEnum. These examples are extracted from open source projects. 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 Project: kylin-on-parquet-v2   Source File: CubeDescCreator.java    License: Apache License 2.0 6 votes vote down vote up
public static CubeDesc generateKylinCubeDesc(String tableName, int storageType,
        List<DimensionDesc> dimensionDescList, List<MeasureDesc> measureDescList, RowKeyDesc rowKeyDesc,
        AggregationGroup aggGroup, HBaseMappingDesc hBaseMapping, Map<String, String> overrideProperties) {
    CubeDesc desc = new CubeDesc();
    desc.setName(tableName.replace('.', '_'));
    desc.setModelName(tableName.replace('.', '_'));
    desc.setDescription("");
    desc.setLastModified(0L);
    desc.setDimensions(dimensionDescList);
    desc.setMeasures(measureDescList);
    desc.setRowkey(rowKeyDesc);
    desc.setHbaseMapping(hBaseMapping);
    desc.setNotifyList(Lists.<String> newArrayList());
    desc.setStatusNeedNotify(Lists.newArrayList(JobStatusEnum.ERROR.toString()));
    desc.setAutoMergeTimeRanges(new long[] { 86400000L, 604800000L, 2419200000L });
    desc.setEngineType(IEngineAware.ID_MR_V2);
    desc.setStorageType(storageType);
    desc.setAggregationGroups(Lists.newArrayList(aggGroup));
    desc.getOverrideKylinProps().putAll(overrideProperties);
    desc.updateRandomUuid();
    return desc;
}
 
Example 2
Source Project: kylin-on-parquet-v2   Source File: JobInstanceExtractor.java    License: Apache License 2.0 6 votes vote down vote up
private JobStatusEnum parseToJobStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStatusEnum.PENDING;
    case RUNNING:
        return JobStatusEnum.RUNNING;
    case ERROR:
        return JobStatusEnum.ERROR;
    case DISCARDED:
        return JobStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStatusEnum.FINISHED;
    case STOPPED:
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example 3
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverter.java    License: Apache License 2.0 6 votes vote down vote up
public static JobStatusEnum parseToJobStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStatusEnum.PENDING;
    case RUNNING:
        return JobStatusEnum.RUNNING;
    case ERROR:
        return JobStatusEnum.ERROR;
    case DISCARDED:
        return JobStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStatusEnum.FINISHED;
    case STOPPED:
        return JobStatusEnum.STOPPED;
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example 4
Source Project: kylin-on-parquet-v2   Source File: JobService.java    License: 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 Project: kylin-on-parquet-v2   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
/**
* currently only support substring match
*
* @return
*/
public List<JobInstance> searchJobs(final String cubeNameSubstring, final String projectName,
        final List<JobStatusEnum> statusList, final Integer limitValue, final Integer offsetValue,
        final JobTimeFilterEnum timeFilter, JobSearchMode jobSearchMode) {
    Integer limit = (null == limitValue) ? 30 : limitValue;
    Integer offset = (null == offsetValue) ? 0 : offsetValue;
    List<JobInstance> jobs = searchJobsByCubeName(cubeNameSubstring, projectName, statusList, timeFilter,
            jobSearchMode);

    Collections.sort(jobs);

    if (jobs.size() <= offset) {
        return Collections.emptyList();
    }

    if ((jobs.size() - offset) < limit) {
        return jobs.subList(offset, jobs.size());
    }

    return jobs.subList(offset, offset + limit);
}
 
Example 6
Source Project: kylin-on-parquet-v2   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
public List<JobInstance> innerSearchJobs(final String cubeName, final String jobName, final String projectName,
        final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter, JobSearchMode jobSearchMode) {
    List<JobInstance> result = Lists.newArrayList();
    switch (jobSearchMode) {
    case ALL:
        result.addAll(innerSearchCubingJobs(cubeName, jobName, projectName, statusList, timeFilter));
        result.addAll(innerSearchCheckpointJobs(cubeName, jobName, projectName, statusList, timeFilter));
        break;
    case CHECKPOINT_ONLY:
        result.addAll(innerSearchCheckpointJobs(cubeName, jobName, projectName, statusList, timeFilter));
        break;
    case CUBING_ONLY:
    default:
        result.addAll(innerSearchCubingJobs(cubeName, jobName, projectName, statusList, timeFilter));
    }
    return result;
}
 
Example 7
Source Project: kylin-on-parquet-v2   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
public List<JobInstance> innerSearchCheckpointJobs(final String cubeName, final String jobName,
        final String projectName, final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter) {
    // TODO: use cache of jobs for this method
    // prepare time range
    Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.ROOT);
    calendar.setTime(new Date());
    long timeStartInMillis = getTimeStartInMillis(calendar, timeFilter);
    long timeEndInMillis = Long.MAX_VALUE;
    Set<ExecutableState> states = convertStatusEnumToStates(statusList);
    final Map<String, Output> allOutputs = getExecutableManager().getAllOutputs(timeStartInMillis, timeEndInMillis);

    return Lists
            .newArrayList(FluentIterable
                    .from(innerSearchCheckpointJobs(cubeName, jobName, states, timeStartInMillis, timeEndInMillis,
                            allOutputs, false, projectName))
                    .transform(new Function<CheckpointExecutable, JobInstance>() {
                        @Override
                        public JobInstance apply(CheckpointExecutable checkpointExecutable) {
                            return JobInfoConverter.parseToJobInstanceQuietly(checkpointExecutable, allOutputs);
                        }
                    }));
}
 
Example 8
Source Project: kylin-on-parquet-v2   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * it loads all cache for digest metadata of "execute" and "execute_output", and returns the search results within the scope of the given filters
 *
 * @return List of search results searched by the method
 *
 */
public List<JobSearchResult> searchJobsByCubeNameV2(final String cubeNameSubstring, final String projectName,
        final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter,
        final JobSearchMode jobSearchMode) {
    List<JobSearchResult> result = Lists.newArrayList();
    switch (jobSearchMode) {
    case ALL:
        result.addAll(innerSearchCubingJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        result.addAll(innerSearchCheckpointJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        break;
    case CHECKPOINT_ONLY:
        result.addAll(innerSearchCheckpointJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        break;
    case CUBING_ONLY:
    default:
        result.addAll(innerSearchCubingJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
    }
    return result;
}
 
Example 9
Source Project: kylin   Source File: CubeDescCreator.java    License: Apache License 2.0 6 votes vote down vote up
public static CubeDesc generateKylinCubeDesc(String tableName, int storageType,
        List<DimensionDesc> dimensionDescList, List<MeasureDesc> measureDescList, RowKeyDesc rowKeyDesc,
        AggregationGroup aggGroup, HBaseMappingDesc hBaseMapping, Map<String, String> overrideProperties) {
    CubeDesc desc = new CubeDesc();
    desc.setName(tableName.replace('.', '_'));
    desc.setModelName(tableName.replace('.', '_'));
    desc.setDescription("");
    desc.setLastModified(0L);
    desc.setDimensions(dimensionDescList);
    desc.setMeasures(measureDescList);
    desc.setRowkey(rowKeyDesc);
    desc.setHbaseMapping(hBaseMapping);
    desc.setNotifyList(Lists.<String> newArrayList());
    desc.setStatusNeedNotify(Lists.newArrayList(JobStatusEnum.ERROR.toString()));
    desc.setAutoMergeTimeRanges(new long[] { 86400000L, 604800000L, 2419200000L, 7776000000L, 31104000000L });
    desc.setEngineType(IEngineAware.ID_MR_V2);
    desc.setStorageType(storageType);
    desc.setAggregationGroups(Lists.newArrayList(aggGroup));
    desc.getOverrideKylinProps().putAll(overrideProperties);
    desc.updateRandomUuid();
    return desc;
}
 
Example 10
Source Project: kylin   Source File: JobInstanceExtractor.java    License: Apache License 2.0 6 votes vote down vote up
private JobStatusEnum parseToJobStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStatusEnum.PENDING;
    case RUNNING:
        return JobStatusEnum.RUNNING;
    case ERROR:
        return JobStatusEnum.ERROR;
    case DISCARDED:
        return JobStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStatusEnum.FINISHED;
    case STOPPED:
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example 11
Source Project: kylin   Source File: JobInfoConverter.java    License: Apache License 2.0 6 votes vote down vote up
public static JobStatusEnum parseToJobStatus(ExecutableState state) {
    switch (state) {
    case READY:
        return JobStatusEnum.PENDING;
    case RUNNING:
        return JobStatusEnum.RUNNING;
    case ERROR:
        return JobStatusEnum.ERROR;
    case DISCARDED:
        return JobStatusEnum.DISCARDED;
    case SUCCEED:
        return JobStatusEnum.FINISHED;
    case STOPPED:
        return JobStatusEnum.STOPPED;
    default:
        throw new RuntimeException("invalid state:" + state);
    }
}
 
Example 12
Source Project: kylin   Source File: JobInfoConverterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testParseToJobInstance4CuboidJob() {
    TestJob task = new TestJob();
    String jobId = UUID.randomUUID().toString();
    String cubeName = "cube1";
    task.setId(jobId);
    task.setParam(CubingExecutableUtil.CUBE_NAME, cubeName);
    Map<String, Output> outPutMap = Maps.newHashMap();
    DefaultOutput executeOutput = new DefaultOutput();
    executeOutput.setState(ExecutableState.READY);
    Map<String, String> extraMap = Maps.newHashMap();
    executeOutput.setExtra(extraMap);
    outPutMap.put(jobId, executeOutput);

    JobInstance instance3 = JobInfoConverter.parseToJobInstanceQuietly(task, outPutMap);
    // no exception thrown is expected
    assertEquals(jobId, instance3.getId());
    assertEquals(CubeBuildTypeEnum.BUILD, instance3.getType());
    assertEquals(cubeName, instance3.getRelatedCube());
    assertEquals(JobStatusEnum.PENDING, instance3.getStatus());
}
 
Example 13
Source Project: kylin   Source File: JobInfoConverterTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testParseToJobInstance4CheckpointJob() {
    Test2Job task = new Test2Job();
    String jobId = UUID.randomUUID().toString();
    String cubeName = "cube1";
    task.setId(jobId);
    task.setParam(CubingExecutableUtil.CUBE_NAME, cubeName);
    Map<String, Output> outPutMap = Maps.newHashMap();
    DefaultOutput executeOutput = new DefaultOutput();
    executeOutput.setState(ExecutableState.READY);
    Map<String, String> extraMap = Maps.newHashMap();
    executeOutput.setExtra(extraMap);
    outPutMap.put(jobId, executeOutput);

    JobInstance instance3 = JobInfoConverter.parseToJobInstanceQuietly(task, outPutMap);
    // no exception thrown is expected
    assertEquals(jobId, instance3.getId());
    assertEquals(CubeBuildTypeEnum.CHECKPOINT, instance3.getType());
    assertEquals(cubeName, instance3.getRelatedCube());
    assertEquals(JobStatusEnum.PENDING, instance3.getStatus());
}
 
Example 14
Source Project: kylin   Source File: JobInfoConverterTest.java    License: 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 15
Source Project: kylin   Source File: JobService.java    License: 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 16
Source Project: kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
/**
* currently only support substring match
*
* @return
*/
public List<JobInstance> searchJobs(final String cubeNameSubstring, final String projectName,
        final List<JobStatusEnum> statusList, final Integer limitValue, final Integer offsetValue,
        final JobTimeFilterEnum timeFilter, JobSearchMode jobSearchMode) {
    Integer limit = (null == limitValue) ? 30 : limitValue;
    Integer offset = (null == offsetValue) ? 0 : offsetValue;
    List<JobInstance> jobs = searchJobsByCubeName(cubeNameSubstring, projectName, statusList, timeFilter,
            jobSearchMode);

    Collections.sort(jobs);

    if (jobs.size() <= offset) {
        return Collections.emptyList();
    }

    if ((jobs.size() - offset) < limit) {
        return jobs.subList(offset, jobs.size());
    }

    return jobs.subList(offset, offset + limit);
}
 
Example 17
Source Project: kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
public List<JobInstance> innerSearchJobs(final String cubeName, final String jobName, final String projectName,
        final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter, JobSearchMode jobSearchMode) {
    List<JobInstance> result = Lists.newArrayList();
    switch (jobSearchMode) {
    case ALL:
        result.addAll(innerSearchCubingJobs(cubeName, jobName, projectName, statusList, timeFilter));
        result.addAll(innerSearchCheckpointJobs(cubeName, jobName, projectName, statusList, timeFilter));
        break;
    case CHECKPOINT_ONLY:
        result.addAll(innerSearchCheckpointJobs(cubeName, jobName, projectName, statusList, timeFilter));
        break;
    case CUBING_ONLY:
    default:
        result.addAll(innerSearchCubingJobs(cubeName, jobName, projectName, statusList, timeFilter));
    }
    return result;
}
 
Example 18
Source Project: kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
public List<JobInstance> innerSearchCheckpointJobs(final String cubeName, final String jobName,
        final String projectName, final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter) {
    // TODO: use cache of jobs for this method
    // prepare time range
    Calendar calendar = Calendar.getInstance(TimeZone.getDefault(), Locale.ROOT);
    calendar.setTime(new Date());
    long timeStartInMillis = getTimeStartInMillis(calendar, timeFilter);
    long timeEndInMillis = Long.MAX_VALUE;
    Set<ExecutableState> states = convertStatusEnumToStates(statusList);
    final Map<String, Output> allOutputs = getExecutableManager().getAllOutputs(timeStartInMillis, timeEndInMillis);

    return Lists
            .newArrayList(FluentIterable
                    .from(innerSearchCheckpointJobs(cubeName, jobName, states, timeStartInMillis, timeEndInMillis,
                            allOutputs, false, projectName))
                    .transform(new Function<CheckpointExecutable, JobInstance>() {
                        @Override
                        public JobInstance apply(CheckpointExecutable checkpointExecutable) {
                            return JobInfoConverter.parseToJobInstanceQuietly(checkpointExecutable, allOutputs);
                        }
                    }));
}
 
Example 19
Source Project: kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * it loads all cache for digest metadata of "execute" and "execute_output", and returns the search results within the scope of the given filters
 *
 * @return List of search results searched by the method
 *
 */
public List<JobSearchResult> searchJobsByCubeNameV2(final String cubeNameSubstring, final String projectName,
        final List<JobStatusEnum> statusList, final JobTimeFilterEnum timeFilter,
        final JobSearchMode jobSearchMode) {
    List<JobSearchResult> result = Lists.newArrayList();
    switch (jobSearchMode) {
    case ALL:
        result.addAll(innerSearchCubingJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        result.addAll(innerSearchCheckpointJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        break;
    case CHECKPOINT_ONLY:
        result.addAll(innerSearchCheckpointJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
        break;
    case CUBING_ONLY:
    default:
        result.addAll(innerSearchCubingJobsV2(cubeNameSubstring, null, projectName, statusList, timeFilter));
    }
    return result;
}
 
Example 20
Source Project: Kylin   Source File: CubeMetadataUpgrade.java    License: Apache License 2.0 6 votes vote down vote up
private ExecutableState parseState(JobStatusEnum state) {
    switch (state) {
        case NEW:
        case PENDING:
            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 21
Source Project: Kylin   Source File: JobController.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * get all cube jobs
 * 
 * @return
 * @throws IOException
 */
@RequestMapping(value = "", method = { RequestMethod.GET })
@ResponseBody
public List<JobInstance> list(JobListRequest jobRequest) {

    List<JobInstance> jobInstanceList = Collections.emptyList();
    List<JobStatusEnum> statusList = new ArrayList<JobStatusEnum>();

    if (null != jobRequest.getStatus()) {
        for (int status : jobRequest.getStatus()) {
            statusList.add(JobStatusEnum.getByCode(status));
        }
    }

    try {
        jobInstanceList = jobService.listAllJobs(jobRequest.getCubeName(), jobRequest.getProjectName(), statusList, jobRequest.getLimit(), jobRequest.getOffset());
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException(e);
    }
    return jobInstanceList;
}
 
Example 22
Source Project: Kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
public List<JobInstance> listAllJobs(final String cubeName, final String projectName, final List<JobStatusEnum> statusList, final Integer limitValue, final Integer offsetValue) throws IOException, JobException {
    Integer limit = (null == limitValue) ? 30 : limitValue;
    Integer offset = (null == offsetValue) ? 0 : offsetValue;
    List<JobInstance> jobs = listAllJobs(cubeName, projectName, statusList);
    Collections.sort(jobs);

    if (jobs.size() <= offset) {
        return Collections.emptyList();
    }

    if ((jobs.size() - offset) < limit) {
        return jobs.subList(offset, jobs.size());
    }

    return jobs.subList(offset, offset + limit);
}
 
Example 23
Source Project: Kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
private List<JobInstance> listCubeJobInstance(final String cubeName, final String projectName, List<JobStatusEnum> statusList) {
    Set<ExecutableState> states;
    if (statusList == null || statusList.isEmpty()) {
        states = EnumSet.allOf(ExecutableState.class);
    } else {
        states = Sets.newHashSet();
        for (JobStatusEnum status : statusList) {
            states.add(parseToExecutableState(status));
        }
    }
    return Lists.newArrayList(FluentIterable.from(listAllCubingJobs(cubeName, projectName, states)).transform(new Function<CubingJob, JobInstance>() {
        @Override
        public JobInstance apply(CubingJob cubingJob) {
            return parseToJobInstance(cubingJob);
        }
    }));
}
 
Example 24
Source Project: Kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
private ExecutableState parseToExecutableState(JobStatusEnum status) {
    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;
        default:
            throw new RuntimeException("illegal status:" + status);
    }
}
 
Example 25
Source Project: Kylin   Source File: JobService.java    License: Apache License 2.0 6 votes vote down vote up
private JobStatusEnum parseToJobStatus(ExecutableState state) {
    switch (state) {
        case READY:
            return JobStatusEnum.PENDING;
        case RUNNING:
            return JobStatusEnum.RUNNING;
        case ERROR:
            return JobStatusEnum.ERROR;
        case DISCARDED:
            return JobStatusEnum.DISCARDED;
        case SUCCEED:
            return JobStatusEnum.FINISHED;
        case STOPPED:
        default:
            throw new RuntimeException("invalid state:" + state);
    }
}
 
Example 26
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverterTest.java    License: 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 27
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusFinished() {
    ExecutableState executableState = ExecutableState.SUCCEED;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(4, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.FINISHED, jobStatusEnum);
}
 
Example 28
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusError() {
    ExecutableState executableState = ExecutableState.ERROR;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(8, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.ERROR, jobStatusEnum);
}
 
Example 29
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusRunning() {
    ExecutableState executableState = ExecutableState.RUNNING;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(2, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.RUNNING, jobStatusEnum);
}
 
Example 30
Source Project: kylin-on-parquet-v2   Source File: JobInfoConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParseToJobStatusReturnsJobStatusDiscarded() {
    ExecutableState executableState = ExecutableState.DISCARDED;
    JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState);

    assertEquals(16, jobStatusEnum.getCode());
    assertEquals(JobStatusEnum.DISCARDED, jobStatusEnum);
}