final Map<String, Output> allOutputs, final boolean nameExactMatch, final String projectName) { List<CubingJob> results = Lists.newArrayList( FluentIterable.from(getExecutableManager().getAllExecutables(timeStartInMillis, timeEndInMillis)) .filter(new Predicate<AbstractExecutable>() { @Override
final Map<String, Output> allOutputs, final boolean nameExactMatch, final String projectName) { List<CheckpointExecutable> results = Lists.newArrayList( FluentIterable.from(getExecutableManager().getAllExecutables(timeStartInMillis, timeEndInMillis)) .filter(new Predicate<AbstractExecutable>() { @Override
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; }
@Test public void test() throws Exception { assertNotNull(service); // all existing are broken jobs List<AbstractExecutable> existing = service.getAllExecutables(); for (AbstractExecutable exec : existing) { assertEquals("BrokenExecutable", exec.getClass().getSimpleName()); assertEquals(ExecutableState.DISCARDED, exec.getStatus()); } 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(existing.size() + 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())); }
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; }