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);
}
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());
}
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());
}
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);
}
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());
}
Aggregations