use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class JobMasterTest method cancel.
@Test
public void cancel() throws Exception {
mockStatic(PlanCoordinator.class);
PlanCoordinator coordinator = PowerMockito.mock(PlanCoordinator.class);
when(PlanCoordinator.create(any(CommandManager.class), any(JobServerContext.class), anyList(), anyLong(), any(JobConfig.class), any(Consumer.class))).thenReturn(coordinator);
SleepJobConfig config = new SleepJobConfig(10000);
long jobId = mJobMaster.run(config);
mJobMaster.cancel(jobId);
verify(coordinator).cancel();
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class PlanTrackerTest method addJob.
private long addJob(PlanTracker tracker, int sleepTimeMs) throws Exception {
long jobId = mJobIdGenerator.getNewJobId();
tracker.run(new SleepJobConfig(sleepTimeMs), mCommandManager, mMockJobServerContext, mWorkers, jobId);
return jobId;
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class TaskExecutorTest method runFailure.
@Test
public void runFailure() throws Exception {
long jobId = 1;
long taskId = 2;
JobConfig jobConfig = new SleepJobConfig(10);
Serializable taskArgs = Lists.newArrayList(1);
RunTaskContext context = mock(RunTaskContext.class);
@SuppressWarnings("unchecked") PlanDefinition<JobConfig, Serializable, Serializable> planDefinition = mock(PlanDefinition.class);
when(mRegistry.getJobDefinition(eq(jobConfig))).thenReturn(planDefinition);
when(planDefinition.runTask(eq(jobConfig), any(Serializable.class), any(RunTaskContext.class))).thenThrow(new UnsupportedOperationException("failure"));
RunTaskCommand command = RunTaskCommand.newBuilder().setJobConfig(ByteString.copyFrom(SerializationUtils.serialize(jobConfig))).setTaskArgs(ByteString.copyFrom(SerializationUtils.serialize(taskArgs))).build();
TaskExecutor executor = new TaskExecutor(jobId, taskId, command, context, mTaskExecutorManager);
executor.run();
verify(mTaskExecutorManager).notifyTaskFailure(eq(jobId), eq(taskId), any());
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class JobMasterIntegrationTest method restartMasterAndReregisterWorker.
@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.JOB_MASTER_LOST_WORKER_INTERVAL, "10000000" })
public void restartMasterAndReregisterWorker() 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));
final long firstWorkerId = mJobMaster.getWorkerInfoList().get(0).getId();
mLocalAlluxioJobCluster.restartWorker();
CommonUtils.waitFor("Restarted worker to register with job master", () -> {
List<WorkerInfo> workerInfo = mJobMaster.getWorkerInfoList();
return !workerInfo.isEmpty() && workerInfo.get(0).getId() != firstWorkerId;
}, WaitForOptions.defaults().setTimeoutMs(10 * Constants.SECOND_MS));
// The restarted worker should replace the original worker since they have the same address.
assertEquals(1, mJobMaster.getWorkerInfoList().size());
}
use of alluxio.job.SleepJobConfig in project alluxio by Alluxio.
the class CompositeIntegrationTest method waitSequential.
@Test
public void waitSequential() throws Exception {
CompositeConfig config = new CompositeConfig(Lists.newArrayList(new SleepJobConfig(1000000), new SleepJobConfig(1)), true);
long jobId = mJobMaster.run(config);
JobInfo status = mJobMaster.getStatus(jobId);
assertEquals(Status.RUNNING, status.getStatus());
assertEquals(1, status.getChildren().size());
}
Aggregations