use of alluxio.job.wire.WorkflowInfo in project alluxio by Alluxio.
the class WorkflowTrackerTest method testBasic.
@Test
public void testBasic() throws Exception {
ArrayList<JobConfig> jobs = Lists.newArrayList();
TestPlanConfig child1 = new TestPlanConfig("1");
TestPlanConfig child2 = new TestPlanConfig("2");
jobs.add(child1);
jobs.add(child2);
CompositeConfig config = new CompositeConfig(jobs, true);
mWorkflowTracker.run(config, 0);
verify(mMockJobMaster).run(child1, 100);
WorkflowInfo info = mWorkflowTracker.getStatus(0, true);
assertEquals(Status.RUNNING, info.getStatus());
verify(mMockJobMaster, never()).run(child2, 101);
PlanInfo plan100 = new PlanInfo(100, child1, null);
plan100.setStatus(Status.COMPLETED);
mWorkflowTracker.onPlanStatusChange(plan100);
verify(mMockJobMaster).run(child2, 101);
assertEquals(Status.RUNNING, mWorkflowTracker.getStatus(0, true).getStatus());
PlanInfo plan101 = new PlanInfo(101, child2, null);
plan101.setStatus(Status.COMPLETED);
mWorkflowTracker.onPlanStatusChange(plan101);
assertEquals(Status.COMPLETED, mWorkflowTracker.getStatus(0, true).getStatus());
}
use of alluxio.job.wire.WorkflowInfo in project alluxio by Alluxio.
the class WorkflowTracker method getStatus.
/**
* Gets information of the given job id.
*
* @param jobId the id of the job
* @param verbose whether the output should be verbose
* @return null if the job id isn't know by the workflow tracker. WorkflowInfo otherwise
*/
public WorkflowInfo getStatus(long jobId, boolean verbose) {
WorkflowExecution workflowExecution = mWorkflows.get(jobId);
if (workflowExecution == null) {
return null;
}
ArrayList<Long> children = Lists.newArrayList(mChildren.get(jobId).iterator());
Collections.sort(children);
List<JobInfo> jobInfos = Lists.newArrayList();
if (verbose) {
for (long child : children) {
try {
jobInfos.add(mJobMaster.getStatus(child));
} catch (JobDoesNotExistException e) {
LOG.info(String.format("No job info on child job id %s. Skipping", child));
}
}
}
WorkflowInfo workflowInfo = new WorkflowInfo(jobId, workflowExecution.getName(), workflowExecution.getStatus(), workflowExecution.getLastUpdated(), workflowExecution.getErrorType(), workflowExecution.getErrorMessage(), jobInfos);
return workflowInfo;
}
use of alluxio.job.wire.WorkflowInfo in project alluxio by Alluxio.
the class WorkflowTrackerTest method testEmpty.
@Test
public void testEmpty() throws Exception {
ArrayList<JobConfig> jobs = Lists.newArrayList();
CompositeConfig config = new CompositeConfig(jobs, true);
mWorkflowTracker.run(config, 0);
WorkflowInfo info = mWorkflowTracker.getStatus(0, true);
assertEquals(Status.COMPLETED, info.getStatus());
}
Aggregations