本文整理汇总了Java中org.apache.kylin.job.dao.ExecutablePO类的典型用法代码示例。如果您正苦于以下问题:Java ExecutablePO类的具体用法?Java ExecutablePO怎么用?Java ExecutablePO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutablePO类属于org.apache.kylin.job.dao包,在下文中一共展示了ExecutablePO类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
private static ExecutablePO parse(AbstractExecutable executable) {
ExecutablePO result = new ExecutablePO();
result.setName(executable.getName());
result.setUuid(executable.getId());
result.setType(executable.getClass().getName());
result.setParams(executable.getParams());
if (executable instanceof ChainedExecutable) {
List<ExecutablePO> tasks = Lists.newArrayList();
for (AbstractExecutable task : ((ChainedExecutable) executable).getTasks()) {
tasks.add(parse(task));
}
result.setTasks(tasks);
}
if (executable instanceof CheckpointExecutable) {
List<ExecutablePO> tasksForCheck = Lists.newArrayList();
for (AbstractExecutable taskForCheck : ((CheckpointExecutable) executable).getSubTasksForCheck()) {
tasksForCheck.add(parse(taskForCheck));
}
result.setTasksForCheck(tasksForCheck);
}
return result;
}
示例2: updateCheckpointJob
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
public void updateCheckpointJob(String jobId, List<AbstractExecutable> subTasksForCheck) {
try {
final ExecutablePO job = executableDao.getJob(jobId);
Preconditions.checkArgument(job != null, "there is no related job for job id:" + jobId);
List<ExecutablePO> tasksForCheck = Lists.newArrayListWithExpectedSize(subTasksForCheck.size());
for (AbstractExecutable taskForCheck : subTasksForCheck) {
tasksForCheck.add(parse(taskForCheck));
}
job.setTasksForCheck(tasksForCheck);
executableDao.updateJob(job);
} catch (PersistentException e) {
logger.error("fail to update checkpoint job:" + jobId, e);
throw new RuntimeException(e);
}
}
示例3: forceKillJob
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
public void forceKillJob(String jobId) {
try {
final ExecutableOutputPO jobOutput = executableDao.getJobOutput(jobId);
jobOutput.setStatus(ExecutableState.ERROR.toString());
List<ExecutablePO> tasks = executableDao.getJob(jobId).getTasks();
for (ExecutablePO task : tasks) {
if (executableDao.getJobOutput(task.getId()).getStatus().equals("SUCCEED")) {
continue;
} else if (executableDao.getJobOutput(task.getId()).getStatus().equals("RUNNING")) {
updateJobOutput(task.getId(), ExecutableState.READY, Maps.<String, String> newHashMap(), "");
}
break;
}
executableDao.updateJobOutput(jobOutput);
} catch (PersistentException e) {
throw new RuntimeException(e);
}
}
示例4: parseTo
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
private static AbstractExecutable parseTo(ExecutablePO executablePO) {
if (executablePO == null) {
return null;
}
String type = executablePO.getType();
try {
Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class);
Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor();
AbstractExecutable result = constructor.newInstance();
result.setId(executablePO.getUuid());
result.setName(executablePO.getName());
result.setParams(executablePO.getParams());
List<ExecutablePO> tasks = executablePO.getTasks();
if (tasks != null && !tasks.isEmpty()) {
Preconditions.checkArgument(result instanceof DefaultChainedExecutable);
for (ExecutablePO subTask: tasks) {
((DefaultChainedExecutable) result).addTask(parseTo(subTask));
}
}
return result;
} catch (ReflectiveOperationException e) {
throw new IllegalArgumentException("cannot parse this job:" + executablePO.getId(), e);
}
}
示例5: parseTo
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
private AbstractExecutable parseTo(ExecutablePO executablePO) {
if (executablePO == null) {
logger.warn("executablePO is null");
return null;
}
String type = executablePO.getType();
try {
Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class);
Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor();
AbstractExecutable result = constructor.newInstance();
result.initConfig(config);
result.setId(executablePO.getUuid());
result.setName(executablePO.getName());
result.setParams(executablePO.getParams());
List<ExecutablePO> tasks = executablePO.getTasks();
if (tasks != null && !tasks.isEmpty()) {
Preconditions.checkArgument(result instanceof ChainedExecutable);
for (ExecutablePO subTask : tasks) {
((ChainedExecutable) result).addTask(parseTo(subTask));
}
}
List<ExecutablePO> tasksForCheck = executablePO.getTasksForCheck();
if (tasksForCheck != null && !tasksForCheck.isEmpty()) {
Preconditions.checkArgument(result instanceof CheckpointExecutable);
for (ExecutablePO subTaskForCheck : tasksForCheck) {
((CheckpointExecutable) result).addTaskForCheck(parseTo(subTaskForCheck));
}
}
return result;
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("cannot parse this job:" + executablePO.getId(), e);
}
}
示例6: getAllExecutables
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
public List<AbstractExecutable> getAllExecutables() {
try {
return Lists.transform(executableDao.getJobs(), new Function<ExecutablePO, AbstractExecutable>() {
@Nullable
@Override
public AbstractExecutable apply(ExecutablePO input) {
return parseTo(input);
}
});
} catch (PersistentException e) {
logger.error("error get All Jobs", e);
throw new RuntimeException(e);
}
}
示例7: parse
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
private static ExecutablePO parse(AbstractExecutable executable) {
ExecutablePO result = new ExecutablePO();
result.setName(executable.getName());
result.setUuid(executable.getId());
result.setType(executable.getClass().getName());
result.setParams(executable.getParams());
if (executable instanceof DefaultChainedExecutable) {
List<ExecutablePO> tasks = Lists.newArrayList();
for (AbstractExecutable task : ((DefaultChainedExecutable) executable).getTasks()) {
tasks.add(parse(task));
}
result.setTasks(tasks);
}
return result;
}
示例8: cleanup
import org.apache.kylin.job.dao.ExecutablePO; //导入依赖的package包/类
public void cleanup() throws Exception {
CubeManager cubeManager = CubeManager.getInstance(config);
List<String> toDeleteResource = Lists.newArrayList();
// two level resources, snapshot tables and cube statistics
for (String resourceRoot : new String[] { ResourceStore.SNAPSHOT_RESOURCE_ROOT, ResourceStore.CUBE_STATISTICS_ROOT }) {
NavigableSet<String> snapshotTables = getStore().listResources(resourceRoot);
if (snapshotTables != null) {
for (String snapshotTable : snapshotTables) {
NavigableSet<String> snapshotNames = getStore().listResources(snapshotTable);
if (snapshotNames != null)
for (String snapshot : snapshotNames) {
if (isOlderThanThreshold(getStore().getResourceTimestamp(snapshot)))
toDeleteResource.add(snapshot);
}
}
}
}
// three level resources, only dictionaries
NavigableSet<String> dictTables = getStore().listResources(ResourceStore.DICT_RESOURCE_ROOT);
if (dictTables != null) {
for (String table : dictTables) {
NavigableSet<String> tableColNames = getStore().listResources(table);
if (tableColNames != null)
for (String tableCol : tableColNames) {
NavigableSet<String> dictionaries = getStore().listResources(tableCol);
if (dictionaries != null)
for (String dict : dictionaries)
if (isOlderThanThreshold(getStore().getResourceTimestamp(dict)))
toDeleteResource.add(dict);
}
}
}
Set<String> activeResourceList = Sets.newHashSet();
for (org.apache.kylin.cube.CubeInstance cube : cubeManager.listAllCubes()) {
for (org.apache.kylin.cube.CubeSegment segment : cube.getSegments()) {
activeResourceList.addAll(segment.getSnapshotPaths());
activeResourceList.addAll(segment.getDictionaryPaths());
activeResourceList.add(segment.getStatisticsResourcePath());
}
}
toDeleteResource.removeAll(activeResourceList);
// delete old and completed jobs
ExecutableDao executableDao = ExecutableDao.getInstance(KylinConfig.getInstanceFromEnv());
List<ExecutablePO> allExecutable = executableDao.getJobs();
for (ExecutablePO executable : allExecutable) {
long lastModified = executable.getLastModified();
ExecutableOutputPO output = executableDao.getJobOutput(executable.getUuid());
if (System.currentTimeMillis() - lastModified > TIME_THREADSHOLD_FOR_JOB && (ExecutableState.SUCCEED.toString().equals(output.getStatus()) || ExecutableState.DISCARDED.toString().equals(output.getStatus()))) {
toDeleteResource.add(ResourceStore.EXECUTE_RESOURCE_ROOT + "/" + executable.getUuid());
toDeleteResource.add(ResourceStore.EXECUTE_OUTPUT_RESOURCE_ROOT + "/" + executable.getUuid());
for (ExecutablePO task : executable.getTasks()) {
toDeleteResource.add(ResourceStore.EXECUTE_OUTPUT_RESOURCE_ROOT + "/" + task.getUuid());
}
}
}
if (toDeleteResource.size() > 0) {
logger.info("The following resources have no reference or is too old, will be cleaned from metadata store: \n");
for (String s : toDeleteResource) {
logger.info(s);
if (delete == true) {
getStore().deleteResource(s);
}
}
} else {
logger.info("No resource to be cleaned up from metadata store;");
}
}