use of alluxio.wire.WorkerInfo in project alluxio by Alluxio.
the class AlluxioMasterRestServiceHandlerTest method getWorkerInfoList.
@Test
public void getWorkerInfoList() {
long worker1 = mBlockMaster.getWorkerId(NET_ADDRESS_1);
long worker2 = mBlockMaster.getWorkerId(NET_ADDRESS_2);
Set<Long> expected = new HashSet<>();
expected.add(worker1);
expected.add(worker2);
Response response = mHandler.getWorkerInfoList();
try {
assertNotNull("Response must be not null!", response);
assertNotNull("Response must have a entry!", response.getEntity());
assertTrue("Entry must be a List!", (response.getEntity() instanceof List));
@SuppressWarnings("unchecked") List<WorkerInfo> entry = (List<WorkerInfo>) response.getEntity();
Set<Long> actual = new HashSet<>();
for (WorkerInfo info : entry) {
actual.add(info.getId());
}
assertEquals(expected, actual);
} finally {
response.close();
}
}
use of alluxio.wire.WorkerInfo in project alluxio by Alluxio.
the class AlluxioMasterRestApiTest method getWorkers.
@Test
public void getWorkers() throws Exception {
List<WorkerInfo> workerInfos = getInfo(NO_PARAMS).getWorkers();
Assert.assertEquals(1, workerInfos.size());
WorkerInfo workerInfo = workerInfos.get(0);
Assert.assertEquals(0, workerInfo.getUsedBytes());
long bytes = Configuration.getBytes(PropertyKey.WORKER_MEMORY_SIZE);
Assert.assertEquals(bytes, workerInfo.getCapacityBytes());
}
use of alluxio.wire.WorkerInfo in project alluxio by Alluxio.
the class CompactDefinitionSelectExecutorsTest method testExecutorsParallel.
@Test
public void testExecutorsParallel() throws Exception {
int tasksPerWorker = 10;
int numCompactedFiles = 100;
int totalFiles = 5000;
PartitionInfo mockPartitionInfo = mock(PartitionInfo.class);
when(mockPartitionInfo.getFormat(any())).thenReturn(Format.CSV);
CompactConfig config = new CompactConfig(mockPartitionInfo, INPUT_DIR, mockPartitionInfo, OUTPUT_DIR, numCompactedFiles, 2 * FileUtils.ONE_GB);
List<URIStatus> inputFiles = new ArrayList<>();
for (int i = 0; i < totalFiles; i++) {
inputFiles.add(newFile(Integer.toString(i)));
}
when(mMockFileSystem.listStatus(new AlluxioURI(INPUT_DIR))).thenReturn(inputFiles);
Set<Pair<WorkerInfo, ArrayList<CompactTask>>> result = new CompactDefinition().selectExecutors(config, SelectExecutorsTest.JOB_WORKERS, new SelectExecutorsContext(1, new JobServerContext(mMockFileSystem, mMockFileSystemContext, mMockUfsManager)));
assertEquals(JOB_WORKERS.size() * tasksPerWorker, result.size());
int allCompactTasks = 0;
for (Pair<WorkerInfo, ArrayList<CompactTask>> tasks : result) {
allCompactTasks += tasks.getSecond().size();
}
assertEquals(numCompactedFiles, allCompactTasks);
}
use of alluxio.wire.WorkerInfo in project alluxio by Alluxio.
the class PlanCoordinatorTest method mockSelectExecutors.
/**
* @param workerInfos the worker infos to return from the mocked selectExecutors method
*/
private void mockSelectExecutors(WorkerInfo... workerInfos) throws Exception {
Set<Pair<WorkerInfo, Serializable>> taskAddressToArgs = Sets.newHashSet();
for (WorkerInfo workerInfo : workerInfos) {
taskAddressToArgs.add(new Pair<>(workerInfo, null));
}
Mockito.when(mPlanDefinition.selectExecutors(Mockito.eq(mJobconfig), Mockito.eq(Lists.newArrayList(mWorkerInfo)), Mockito.any(SelectExecutorsContext.class))).thenReturn(taskAddressToArgs);
}
use of alluxio.wire.WorkerInfo in project alluxio by Alluxio.
the class WorkflowTrackerTest method before.
@Before
public void before() throws Exception {
mMockJobMaster = mock(JobMaster.class);
mWorkflowTracker = new WorkflowTracker(mMockJobMaster);
mPlanTracker = new PlanTracker(CAPACITY, RETENTION_TIME, PURGE_CONUT, mWorkflowTracker);
mJobIdCounter = 100;
when(mMockJobMaster.getNewJobId()).thenAnswer(invocation -> mJobIdCounter++);
mWorkers = Lists.newArrayList(new WorkerInfo());
mCommandManager = new CommandManager();
mMockJobServerContext = mock(JobServerContext.class);
}
Aggregations