use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class WorkflowTrackerTest method testCleanup.
@Test
public void testCleanup() throws Exception {
SleepJobConfig jobConfig = new SleepJobConfig(1);
mPlanTracker.run(jobConfig, mCommandManager, mMockJobServerContext, mWorkers, 1);
jobConfig = new SleepJobConfig(1);
mPlanTracker.run(jobConfig, mCommandManager, mMockJobServerContext, mWorkers, 2);
jobConfig = new SleepJobConfig(1);
mPlanTracker.run(jobConfig, mCommandManager, mMockJobServerContext, mWorkers, 3);
doAnswer(invocation -> {
PlanConfig config = invocation.getArgument(0, PlanConfig.class);
long jobId = invocation.getArgument(1, Long.class);
mPlanTracker.run(config, mCommandManager, mMockJobServerContext, mWorkers, jobId);
return null;
}).when(mMockJobMaster).run(any(PlanConfig.class), any(Long.class));
ArrayList<JobConfig> jobs = Lists.newArrayList();
SleepJobConfig child1 = new SleepJobConfig(1);
SleepJobConfig child2 = new SleepJobConfig(2);
jobs.add(child1);
jobs.add(child2);
CompositeConfig config = new CompositeConfig(jobs, false);
mWorkflowTracker.run(config, 0);
try {
mPlanTracker.run(new SleepJobConfig(1), mCommandManager, mMockJobServerContext, mWorkers, 4);
fail();
} catch (ResourceExhaustedException e) {
// Should fail
}
mPlanTracker.coordinators().stream().filter(coordinator -> coordinator.getJobId() == 100).findFirst().get().setJobAsFailed("TestError", "failed");
mPlanTracker.run(new SleepJobConfig(1), mCommandManager, mMockJobServerContext, mWorkers, 4);
assertNotNull(mWorkflowTracker.getStatus(0, true));
try {
mPlanTracker.run(new SleepJobConfig(1), mCommandManager, mMockJobServerContext, mWorkers, 5);
fail();
} catch (ResourceExhaustedException e) {
// Should fail
}
mPlanTracker.coordinators().stream().filter(coordinator -> coordinator.getJobId() == 101).findFirst().get().setJobAsFailed("TestError", "failed");
mPlanTracker.run(new SleepJobConfig(1), mCommandManager, mMockJobServerContext, mWorkers, 5);
assertNull(mWorkflowTracker.getStatus(100, true));
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class CancelCommandTest method testCancel.
@Test
public void testCancel() throws Exception {
long jobId = sJobMaster.run(new SleepJobConfig(150 * 1000));
sJobShell.run("cancel", Long.toString(jobId));
JobTestUtils.waitForJobStatus(sJobMaster, jobId, Status.CANCELED);
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class CompositeIntegrationTest method nestedTest.
@Test
public void nestedTest() throws Exception {
CompositeConfig config = new CompositeConfig(Lists.newArrayList(new CompositeConfig(Lists.newArrayList(new SleepJobConfig(2), new SleepJobConfig(3)), false), new SleepJobConfig(1)), true);
long jobId = mJobMaster.run(config);
waitForJobToFinish(jobId);
JobInfo status = mJobMaster.getStatus(jobId);
assertEquals(Status.COMPLETED, status.getStatus());
List<JobInfo> children = status.getChildren();
assertEquals(2, children.size());
JobInfo child0 = children.get(0);
assertEquals(child0, mJobMaster.getStatus(children.get(0).getId()));
assertEquals(Status.COMPLETED, child0.getStatus());
assertEquals(2, child0.getChildren().size());
JobInfo child1 = children.get(1);
assertEquals(child1, mJobMaster.getStatus(children.get(1).getId()));
assertEquals(Status.COMPLETED, child1.getStatus());
assertEquals(1, child1.getChildren().size());
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class CompositeIntegrationTest method waitParallel.
@Test
public void waitParallel() throws Exception {
CompositeConfig config = new CompositeConfig(Lists.newArrayList(new SleepJobConfig(1000000), new SleepJobConfig(1)), false);
long jobId = mJobMaster.run(config);
JobInfo status = mJobMaster.getStatus(jobId);
assertEquals(Status.RUNNING, status.getStatus());
assertEquals(2, status.getChildren().size());
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class JobMasterClientRestApiTest method cancel.
@Test
public void cancel() throws Exception {
long jobId = startJob(new SleepJobConfig(10 * Constants.SECOND_MS));
// Sleep to make sure the run request and the cancel request are separated by a job worker
// heartbeat. If not, job service will not handle that case correctly.
CommonUtils.sleepMs(30);
Map<String, String> params = Maps.newHashMap();
params.put("jobId", Long.toString(jobId));
new TestCase(mHostname, mPort, getEndpoint(ServiceConstants.CANCEL), params, HttpMethod.POST, null).run();
waitForStatus(jobId, Status.CANCELED);
}
Aggregations