private void setRelatedIdList(CheckpointExecutable checkpointExecutable, List<String> segmentIdList, List<String> jobIdList) { for (AbstractExecutable taskForCheck : checkpointExecutable.getSubTasksForCheck()) { jobIdList.add(taskForCheck.getId()); if (taskForCheck instanceof CubingJob) { segmentIdList.addAll(Lists .newArrayList(StringUtils.split(CubingExecutableUtil.getSegmentId(taskForCheck.getParams())))); } else if (taskForCheck instanceof CheckpointExecutable) { setRelatedIdList((CheckpointExecutable) taskForCheck, segmentIdList, jobIdList); } } }
private List<JobInstance> listJobInstances(String project, String cube, long startTime, long endTime) { final List<JobInstance> result = Lists.newArrayList(); final List<AbstractExecutable> executables = executableManager.getAllExecutables(startTime, endTime); final Map<String, Output> allOutputs = executableManager.getAllOutputs(); for (AbstractExecutable executable : executables) { if (executable instanceof CubingJob) { String cubeName = CubingExecutableUtil.getCubeName(executable.getParams()); boolean shouldExtract = false; if (cube == null || cube.equalsIgnoreCase(cubeName)) { if (project == null) { shouldExtract = true; } else { ProjectInstance projectInstance = projectManager.getProject(project); if (projectInstance != null && projectInstance.containsRealization(RealizationType.CUBE, cubeName)) { shouldExtract = true; } } } if (shouldExtract) { result.add(parseToJobInstance((CubingJob) executable, allOutputs)); } } } return result; }
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; }
protected JobInstance getCheckpointJobInstance(AbstractExecutable job) { Message msg = MsgPicker.getMsg(); if (job == null) { return null; } if (!(job instanceof CheckpointExecutable)) { throw new BadRequestException(String.format(Locale.ROOT, msg.getILLEGAL_JOB_TYPE(), job.getId())); } CheckpointExecutable checkpointExecutable = (CheckpointExecutable) job; Output output = checkpointExecutable.getOutput(); final JobInstance result = new JobInstance(); result.setName(job.getName()); result.setRelatedCube(CubingExecutableUtil.getCubeName(job.getParams())); result.setDisplayCubeName(CubingExecutableUtil.getCubeName(job.getParams())); result.setLastModified(job.getLastModified()); result.setSubmitter(job.getSubmitter()); result.setUuid(job.getId()); result.setType(CubeBuildTypeEnum.CHECKPOINT); result.setStatus(JobInfoConverter.parseToJobStatus(job.getStatus())); result.setBuildInstance(AbstractExecutable.getBuildInstance(output)); result.setDuration(job.getDuration() / 1000); for (int i = 0; i < checkpointExecutable.getTasks().size(); ++i) { AbstractExecutable task = checkpointExecutable.getTasks().get(i); result.addStep(JobInfoConverter.parseToJobStep(task, i, getExecutableManager().getOutput(task.getId()))); } return result; }
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; }
private List<JobInstance> listJobInstances(String project, String cube, long startTime, long endTime) { final List<JobInstance> result = Lists.newArrayList(); final List<AbstractExecutable> executables = executableManager.getAllExecutables(startTime, endTime); final Map<String, Output> allOutputs = executableManager.getAllOutputs(); for (AbstractExecutable executable : executables) { if (executable instanceof CubingJob) { String cubeName = CubingExecutableUtil.getCubeName(executable.getParams()); boolean shouldExtract = false; if (cube == null || cube.equalsIgnoreCase(cubeName)) { if (project == null) { shouldExtract = true; } else { ProjectInstance projectInstance = projectManager.getProject(project); if (projectInstance != null && projectInstance.containsRealization(RealizationType.CUBE, cubeName)) { shouldExtract = true; } } } if (shouldExtract) { result.add(parseToJobInstance((CubingJob) executable, allOutputs)); } } } return result; }
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); } return result; }
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; }