org.apache.kylin.job.SucceedTestExecutable Java Examples

The following examples show how to use org.apache.kylin.job.SucceedTestExecutable. 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: DefaultSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testIllegalState() throws Exception {
    logger.info("testIllegalState");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new RunningTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    ExecutableManager.getInstance(KylinConfig.getInstanceFromEnv()).updateJobOutput(task2.getId(),
            ExecutableState.RUNNING, null, null);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task2.getId()).getState());
}
 
Example #2
Source File: DefaultSchedulerTest.java    From kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testIllegalState() throws Exception {
    logger.info("testIllegalState");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new RunningTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    ExecutableManager.getInstance(KylinConfig.getInstanceFromEnv()).updateJobOutput(task2.getId(),
            ExecutableState.RUNNING, null, null);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task2.getId()).getState());
}
 
Example #3
Source File: ExecutableManagerTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void test() throws Exception {
    assertNotNull(service);
    BaseTestExecutable executable = new SucceedTestExecutable();
    executable.setParam("test1", "test1");
    executable.setParam("test2", "test2");
    executable.setParam("test3", "test3");
    service.addJob(executable);
    List<AbstractExecutable> result = service.getAllExecutables();
    assertEquals(1, result.size());
    AbstractExecutable another = service.getJob(executable.getId());
    assertJobEqual(executable, another);

    service.updateJobOutput(executable.getId(), ExecutableState.RUNNING, null, "test output");
    assertJobEqual(executable, service.getJob(executable.getId()));
}
 
Example #4
Source File: DefaultSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndError() throws Exception {
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new ErrorTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    jobService.addJob(job);
    waitForJobFinish(job.getId());
    assertEquals(ExecutableState.ERROR, jobService.getOutput(job.getId()).getState());
    assertEquals(ExecutableState.ERROR, jobService.getOutput(task1.getId()).getState());
    assertEquals(ExecutableState.READY, jobService.getOutput(task2.getId()).getState());
}
 
Example #5
Source File: DefaultSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingleTaskJob() throws Exception {
    logger.info("testSingleTaskJob");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    job.addTask(task1);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
}
 
Example #6
Source File: DefaultSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndFailed() throws Exception {
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new FailedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    jobService.addJob(job);
    waitForJobFinish(job.getId());
    assertEquals(ExecutableState.ERROR, jobService.getOutput(job.getId()).getState());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(task1.getId()).getState());
    assertEquals(ExecutableState.ERROR, jobService.getOutput(task2.getId()).getState());
}
 
Example #7
Source File: DefaultSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceed() throws Exception {
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    jobService.addJob(job);
    waitForJobFinish(job.getId());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(job.getId()).getState());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(task1.getId()).getState());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(task2.getId()).getState());
}
 
Example #8
Source File: DefaultSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingleTaskJob() throws Exception {
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    job.addTask(task1);
    jobService.addJob(job);
    waitForJobFinish(job.getId());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(job.getId()).getState());
    assertEquals(ExecutableState.SUCCEED, jobService.getOutput(task1.getId()).getState());
}
 
Example #9
Source File: ExecutableManagerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalStateTranferException.class)
public void testInvalidStateTransfer(){
    SucceedTestExecutable job = new SucceedTestExecutable();
    service.addJob(job);
    service.updateJobOutput(job.getId(), ExecutableState.RUNNING, null, null);
    service.updateJobOutput(job.getId(), ExecutableState.STOPPED, null, null);
}
 
Example #10
Source File: ExecutableManagerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testValidStateTransfer() throws Exception {
    SucceedTestExecutable job = new SucceedTestExecutable();
    String id = job.getId();
    service.addJob(job);
    service.updateJobOutput(id, ExecutableState.RUNNING, null, null);
    service.updateJobOutput(id, ExecutableState.ERROR, null, null);
    service.updateJobOutput(id, ExecutableState.READY, null, null);
    service.updateJobOutput(id, ExecutableState.RUNNING, null, null);
    service.updateJobOutput(id, ExecutableState.READY, null, null);
    service.updateJobOutput(id, ExecutableState.RUNNING, null, null);
    service.updateJobOutput(id, ExecutableState.SUCCEED, null, null);
}
 
Example #11
Source File: ExecutableManagerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultChainedExecutable() throws Exception {
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    job.addTask(new SucceedTestExecutable());
    job.addTask(new SucceedTestExecutable());

    service.addJob(job);
    assertEquals(2, job.getTasks().size());
    AbstractExecutable anotherJob = service.getJob(job.getId());
    assertEquals(DefaultChainedExecutable.class, anotherJob.getClass());
    assertEquals(2, ((DefaultChainedExecutable) anotherJob).getTasks().size());
    assertJobEqual(job, anotherJob);
}
 
Example #12
Source File: DefaultSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndError() throws Exception {
    logger.info("testSucceedAndError");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new ErrorTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.READY, execMgr.getOutput(task2.getId()).getState());
}
 
Example #13
Source File: DefaultSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndFailed() throws Exception {
    logger.info("testSucceedAndFailed");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new FailedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task2.getId()).getState());
}
 
Example #14
Source File: DefaultSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceed() throws Exception {
    logger.info("testSucceed");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task2.getId()).getState());
}
 
Example #15
Source File: DefaultSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingleTaskJob() throws Exception {
    logger.info("testSingleTaskJob");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    job.addTask(task1);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
}
 
Example #16
Source File: DefaultSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndError() throws Exception {
    logger.info("testSucceedAndError");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new ErrorTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.READY, execMgr.getOutput(task2.getId()).getState());
}
 
Example #17
Source File: DefaultSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceedAndFailed() throws Exception {
    logger.info("testSucceedAndFailed");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new FailedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.ERROR, execMgr.getOutput(task2.getId()).getState());
}
 
Example #18
Source File: DefaultSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testSucceed() throws Exception {
    logger.info("testSucceed");
    DefaultChainedExecutable job = new DefaultChainedExecutable();
    BaseTestExecutable task1 = new SucceedTestExecutable();
    BaseTestExecutable task2 = new SucceedTestExecutable();
    job.addTask(task1);
    job.addTask(task2);
    execMgr.addJob(job);
    waitForJobFinish(job.getId(), MAX_WAIT_TIME);
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(job.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task1.getId()).getState());
    Assert.assertEquals(ExecutableState.SUCCEED, execMgr.getOutput(task2.getId()).getState());
}