Search in sources :

Example 6 with SleepJobConfig

use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.

the class JobMasterIntegrationTest method cancel.

@Test
public void cancel() throws Exception {
    SleepJobConfig childJob1 = new SleepJobConfig(50000);
    SleepJobConfig childJob2 = new SleepJobConfig(45000);
    SleepJobConfig childJob3 = new SleepJobConfig(40000);
    CompositeConfig jobConfig = new CompositeConfig(Lists.newArrayList(childJob1, childJob2, childJob3), false);
    long jobId = mJobMaster.run(jobConfig);
    JobInfo status = mJobMaster.getStatus(jobId);
    List<JobInfo> children = status.getChildren();
    assertEquals(3, children.size());
    long child0 = children.get(0).getId();
    long child1 = children.get(1).getId();
    long child2 = children.get(2).getId();
    mJobMaster.cancel(jobId);
    JobTestUtils.waitForJobStatus(mJobMaster, jobId, Status.CANCELED);
    JobTestUtils.waitForJobStatus(mJobMaster, child0, Status.CANCELED);
    JobTestUtils.waitForJobStatus(mJobMaster, child1, Status.CANCELED);
    JobTestUtils.waitForJobStatus(mJobMaster, child2, Status.CANCELED);
}
Also used : JobInfo(alluxio.job.wire.JobInfo) SleepJobConfig(alluxio.job.SleepJobConfig) CompositeConfig(alluxio.job.workflow.composite.CompositeConfig) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 7 with SleepJobConfig

use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.

the class JobMasterIntegrationTest method restartMasterAndLoseWorker.

@Test
public void restartMasterAndLoseWorker() throws Exception {
    long jobId = mJobMaster.run(new SleepJobConfig(1));
    JobTestUtils.waitForJobStatus(mJobMaster, jobId, Status.COMPLETED);
    mJobMaster.stop();
    mJobMaster.start(true);
    CommonUtils.waitFor("Worker to register with restarted job master", () -> !mJobMaster.getWorkerInfoList().isEmpty(), WaitForOptions.defaults().setTimeoutMs(10 * Constants.SECOND_MS));
    mJobWorker.stop();
    CommonUtils.sleepMs(WORKER_TIMEOUT_MS + LOST_WORKER_INTERVAL_MS);
    assertTrue(mJobMaster.getWorkerInfoList().isEmpty());
}
Also used : SleepJobConfig(alluxio.job.SleepJobConfig) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 8 with SleepJobConfig

use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.

the class JobMasterIntegrationTest method stopJobWorkerTasks.

@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.JOB_MASTER_JOB_CAPACITY, "20" })
public void stopJobWorkerTasks() throws Exception {
    long jobId0 = mJobMaster.run(new SleepJobConfig(5000));
    long jobId1 = mJobMaster.run(new SleepJobConfig(5000));
    long jobId2 = mJobMaster.run(new SleepJobConfig(1));
    long jobId3 = mJobMaster.run(new SleepJobConfig(1));
    JobTestUtils.waitForJobStatus(mJobMaster, jobId2, Status.COMPLETED);
    JobTestUtils.waitForJobStatus(mJobMaster, jobId3, Status.COMPLETED);
    assertFalse(mJobMaster.getStatus(jobId1).getStatus().isFinished());
    assertFalse(mJobMaster.getStatus(jobId0).getStatus().isFinished());
    assertEquals(2, mJobMaster.getAllWorkerHealth().get(0).getNumActiveTasks());
    mJobMaster.setTaskPoolSize(0);
    long jobId5 = mJobMaster.run(new SleepJobConfig(1));
    // wait to make sure that this job is not completing any time soon
    CommonUtils.sleepMs(300);
    assertFalse(mJobMaster.getStatus(jobId5).getStatus().isFinished());
    assertEquals(0, mJobMaster.getAllWorkerHealth().get(0).getTaskPoolSize());
    // existing running tasks will continue to run
    assertEquals(2, mJobMaster.getAllWorkerHealth().get(0).getNumActiveTasks());
}
Also used : SleepJobConfig(alluxio.job.SleepJobConfig) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 9 with SleepJobConfig

use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.

the class JobMasterIntegrationTest method throttleJobWorkerTasks.

@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.JOB_MASTER_JOB_CAPACITY, "20" })
public void throttleJobWorkerTasks() throws Exception {
    mJobMaster.setTaskPoolSize(1);
    long jobId0 = mJobMaster.run(new SleepJobConfig(1));
    JobTestUtils.waitForJobStatus(mJobMaster, jobId0, Sets.newHashSet(Status.RUNNING, Status.COMPLETED));
    long jobId1 = mJobMaster.run(new SleepJobConfig(50000));
    JobTestUtils.waitForJobStatus(mJobMaster, jobId1, Status.RUNNING);
    JobTestUtils.waitForJobStatus(mJobMaster, jobId0, Status.COMPLETED);
    long jobId2 = mJobMaster.run(new SleepJobConfig(1));
    long jobId3 = mJobMaster.run(new SleepJobConfig(1));
    // wait a bit more to make sure other jobs aren't completing
    CommonUtils.sleepMs(300);
    assertEquals(Status.RUNNING, mJobMaster.getStatus(jobId1).getStatus());
    assertEquals(Status.CREATED, mJobMaster.getStatus(jobId2).getStatus());
    assertEquals(Status.CREATED, mJobMaster.getStatus(jobId3).getStatus());
    assertEquals(1, mJobMaster.getAllWorkerHealth().get(0).getTaskPoolSize());
    assertEquals(1, mJobMaster.getAllWorkerHealth().get(0).getNumActiveTasks());
    mJobMaster.cancel(jobId1);
    JobTestUtils.waitForJobStatus(mJobMaster, jobId2, Status.COMPLETED);
    JobTestUtils.waitForJobStatus(mJobMaster, jobId3, Status.COMPLETED);
}
Also used : SleepJobConfig(alluxio.job.SleepJobConfig) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Example 10 with SleepJobConfig

use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.

the class JobMasterIntegrationTest method multipleTasksPerWorker.

@Test
public void multipleTasksPerWorker() throws Exception {
    long jobId = mJobMaster.run(new SleepJobConfig(1, 2));
    JobInfo jobStatus = mJobMaster.getStatus(jobId);
    assertEquals(2, jobStatus.getChildren().size());
    JobTestUtils.waitForJobStatus(mJobMaster, jobId, Status.COMPLETED);
    jobStatus = mJobMaster.getStatus(jobId);
    assertEquals(2, jobStatus.getChildren().size());
}
Also used : JobInfo(alluxio.job.wire.JobInfo) SleepJobConfig(alluxio.job.SleepJobConfig) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

SleepJobConfig (alluxio.job.SleepJobConfig)17 Test (org.junit.Test)16 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)6 JobInfo (alluxio.job.wire.JobInfo)5 JobConfig (alluxio.job.JobConfig)4 JobIntegrationTest (alluxio.job.JobIntegrationTest)3 JobServerContext (alluxio.job.JobServerContext)2 CompositeConfig (alluxio.job.workflow.composite.CompositeConfig)2 CommandManager (alluxio.master.job.command.CommandManager)2 WorkerInfo (alluxio.wire.WorkerInfo)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 ResourceExhaustedException (alluxio.exception.status.ResourceExhaustedException)1 RunTaskCommand (alluxio.grpc.RunTaskCommand)1 RunTaskContext (alluxio.job.RunTaskContext)1 TestPlanConfig (alluxio.job.TestPlanConfig)1 PlanConfig (alluxio.job.plan.PlanConfig)1 PlanInfo (alluxio.job.plan.meta.PlanInfo)1 Status (alluxio.job.wire.Status)1 WorkflowInfo (alluxio.job.wire.WorkflowInfo)1 JobMaster (alluxio.master.job.JobMaster)1