Search in sources :

Example 1 with WorkflowInfo

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());
}
Also used : TestPlanConfig(alluxio.job.TestPlanConfig) PlanInfo(alluxio.job.plan.meta.PlanInfo) WorkflowInfo(alluxio.job.wire.WorkflowInfo) CompositeConfig(alluxio.job.workflow.composite.CompositeConfig) SleepJobConfig(alluxio.job.SleepJobConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Example 2 with WorkflowInfo

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;
}
Also used : JobDoesNotExistException(alluxio.exception.JobDoesNotExistException) JobInfo(alluxio.job.wire.JobInfo) WorkflowInfo(alluxio.job.wire.WorkflowInfo) WorkflowExecution(alluxio.job.workflow.WorkflowExecution)

Example 3 with 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());
}
Also used : WorkflowInfo(alluxio.job.wire.WorkflowInfo) CompositeConfig(alluxio.job.workflow.composite.CompositeConfig) SleepJobConfig(alluxio.job.SleepJobConfig) JobConfig(alluxio.job.JobConfig) Test(org.junit.Test)

Aggregations

WorkflowInfo (alluxio.job.wire.WorkflowInfo)3 JobConfig (alluxio.job.JobConfig)2 SleepJobConfig (alluxio.job.SleepJobConfig)2 CompositeConfig (alluxio.job.workflow.composite.CompositeConfig)2 Test (org.junit.Test)2 JobDoesNotExistException (alluxio.exception.JobDoesNotExistException)1 TestPlanConfig (alluxio.job.TestPlanConfig)1 PlanInfo (alluxio.job.plan.meta.PlanInfo)1 JobInfo (alluxio.job.wire.JobInfo)1 WorkflowExecution (alluxio.job.workflow.WorkflowExecution)1