Java Code Examples for org.apache.kylin.job.execution.AbstractExecutable#getStatus()

The following examples show how to use org.apache.kylin.job.execution.AbstractExecutable#getStatus() . 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: ExecutableManager.java    From Kylin with Apache License 2.0 6 votes vote down vote up
public void resumeJob(String jobId) {
    AbstractExecutable job = getJob(jobId);
    if (job == null) {
        return;
    }
    updateJobOutput(jobId, ExecutableState.READY, null, null);
    if (job instanceof DefaultChainedExecutable) {
        List<AbstractExecutable> tasks = ((DefaultChainedExecutable) job).getTasks();
        for (AbstractExecutable task : tasks) {
            if (task.getStatus() == ExecutableState.ERROR) {
                updateJobOutput(task.getId(), ExecutableState.READY, null, null);
                break;
            }
        }
    }
}
 
Example 2
Source File: BuildCubeWithStream.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJob(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == ExecutableState.SUCCEED || job.getStatus() == ExecutableState.ERROR
                || job.getStatus() == ExecutableState.DISCARDED) {
            break;
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 3
Source File: BaseSchedulerTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected void runningJobToError(String jobId) {
    while (true) {
        try {
            AbstractExecutable job = execMgr.getJob(jobId);
            ExecutableState status = job.getStatus();
            if (status == ExecutableState.RUNNING) {
                scheduler.getFetcherRunner().setFetchFailed(true);
                break;
            }
            Thread.sleep(1000);
        } catch (Exception ex) {
            logger.error("", ex);
        }
    }
}
 
Example 4
Source File: BaseSchedulerTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJobStatus(String jobId, ExecutableState state, long interval) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == state) {
            break;
        } else {
            try {
                Thread.sleep(interval);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 5
Source File: BuildIIWithEngineTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJob(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == ExecutableState.SUCCEED || job.getStatus() == ExecutableState.ERROR) {
            break;
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 6
Source File: DistributedScheduler.java    From kylin with Apache License 2.0 5 votes vote down vote up
private void releaseJobLock(AbstractExecutable executable) {
    if (executable instanceof DefaultChainedExecutable) {
        ExecutableState state = executable.getStatus();

        if (state != ExecutableState.READY && state != ExecutableState.RUNNING) {
            if (jobWithLocks.contains(executable.getId())) {
                logger.info(
                        executable.toString() + " will release the lock for the job: " + executable.getId());
                jobLock.unlock(getLockPath(executable.getId()));
                jobWithLocks.remove(executable.getId());
            }
        }
    }
}
 
Example 7
Source File: CubingJob.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
protected void onExecuteFinished(ExecuteResult result, ExecutableContext executableContext) {
    long time = 0L;
    for (AbstractExecutable task : getTasks()) {
        final ExecutableState status = task.getStatus();
        if (status != ExecutableState.SUCCEED) {
            break;
        }
        if (task instanceof MapReduceExecutable) {
            time += ((MapReduceExecutable) task).getMapReduceWaitTime();
        }
    }
    setMapReduceWaitTime(time);
    super.onExecuteFinished(result, executableContext);
}
 
Example 8
Source File: BaseTestDistributedScheduler.java    From kylin with Apache License 2.0 5 votes vote down vote up
void waitForJobStatus(String jobId, ExecutableState state, long interval) {
    while (true) {
        AbstractExecutable job = execMgr.getJob(jobId);
        if (state == job.getStatus()) {
            break;
        } else {
            try {
                Thread.sleep(interval);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
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: BuildCubeWithEngine.java    From kylin with Apache License 2.0 5 votes vote down vote up
protected ExecutableState waitForJob(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == ExecutableState.SUCCEED || job.getStatus() == ExecutableState.ERROR) {
            return job.getStatus();
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 11
Source File: CubingJob.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Override
protected void onExecuteFinished(ExecuteResult result, ExecutableContext executableContext) {
    long time = 0L;
    for (AbstractExecutable task: getTasks()) {
        final ExecutableState status = task.getStatus();
        if (status != ExecutableState.SUCCEED) {
            break;
        }
        if (task instanceof MapReduceExecutable) {
            time += ((MapReduceExecutable) task).getMapReduceWaitTime();
        }
    }
    setMapReduceWaitTime(time);
    super.onExecuteFinished(result, executableContext);
}
 
Example 12
Source File: BuildCubeWithEngineTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void waitForJob(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == ExecutableState.SUCCEED || job.getStatus() == ExecutableState.ERROR) {
            break;
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 13
Source File: BaseSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected void runningJobToError(String jobId) {
    while (true) {
        try {
            AbstractExecutable job = execMgr.getJob(jobId);
            ExecutableState status = job.getStatus();
            if (status == ExecutableState.RUNNING) {
                scheduler.getFetcherRunner().setFetchFailed(true);
                break;
            }
            Thread.sleep(1000);
        } catch (Exception ex) {
            logger.error("", ex);
        }
    }
}
 
Example 14
Source File: BaseSchedulerTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected void waitForJobStatus(String jobId, ExecutableState state, long interval) {
    while (true) {
        AbstractExecutable job = execMgr.getJob(jobId);
        if (job.getStatus() == state) {
            break;
        } else {
            try {
                Thread.sleep(interval);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 15
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 16
Source File: DistributedScheduler.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private void releaseJobLock(AbstractExecutable executable) {
    if (executable instanceof DefaultChainedExecutable) {
        ExecutableState state = executable.getStatus();

        if (state != ExecutableState.READY && state != ExecutableState.RUNNING) {
            if (jobWithLocks.contains(executable.getId())) {
                logger.info(
                        executable.toString() + " will release the lock for the job: " + executable.getId());
                jobLock.unlock(getLockPath(executable.getId()));
                jobWithLocks.remove(executable.getId());
            }
        }
    }
}
 
Example 17
Source File: CubingJob.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onExecuteFinished(ExecuteResult result, ExecutableContext executableContext) {
    long time = 0L;
    for (AbstractExecutable task : getTasks()) {
        final ExecutableState status = task.getStatus();
        if (status != ExecutableState.SUCCEED) {
            break;
        }
        if (task instanceof MapReduceExecutable) {
            time += ((MapReduceExecutable) task).getMapReduceWaitTime();
        }
    }
    setMapReduceWaitTime(time);
    super.onExecuteFinished(result, executableContext);
}
 
Example 18
Source File: BaseTestDistributedScheduler.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
void waitForJobStatus(String jobId, ExecutableState state, long interval) {
    while (true) {
        AbstractExecutable job = execMgr.getJob(jobId);
        if (state == job.getStatus()) {
            break;
        } else {
            try {
                Thread.sleep(interval);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 19
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 20
Source File: BuildCubeWithEngine.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
protected ExecutableState waitForJob(String jobId) {
    while (true) {
        AbstractExecutable job = jobService.getJob(jobId);
        if (job.getStatus() == ExecutableState.SUCCEED || job.getStatus() == ExecutableState.ERROR) {
            return job.getStatus();
        } else {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}