本文整理匯總了Java中org.apache.tajo.master.rm.WorkerResource類的典型用法代碼示例。如果您正苦於以下問題:Java WorkerResource類的具體用法?Java WorkerResource怎麽用?Java WorkerResource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorkerResource類屬於org.apache.tajo.master.rm包,在下文中一共展示了WorkerResource類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAllWorkerResource
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
@Override
public void getAllWorkerResource(RpcController controller, PrimitiveProtos.NullProto request,
RpcCallback<TajoMasterProtocol.WorkerResourcesRequest> done) {
TajoMasterProtocol.WorkerResourcesRequest.Builder builder =
TajoMasterProtocol.WorkerResourcesRequest.newBuilder();
Collection<Worker> workers = context.getResourceManager().getWorkers().values();
for(Worker worker: workers) {
WorkerResource resource = worker.getResource();
TajoMasterProtocol.WorkerResourceProto.Builder workerResource =
TajoMasterProtocol.WorkerResourceProto.newBuilder();
workerResource.setHost(worker.getHostName());
workerResource.setPeerRpcPort(worker.getPeerRpcPort());
workerResource.setInfoPort(worker.getHttpPort());
workerResource.setQueryMasterPort(worker.getQueryMasterPort());
workerResource.setMemoryMB(resource.getMemoryMB());
workerResource.setDiskSlots(resource.getDiskSlots());
workerResource.setQueryMasterPort(worker.getQueryMasterPort());
builder.addWorkerResources(workerResource);
}
done.run(builder.build());
}
示例2: startQueryMaster
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
public boolean startQueryMaster() {
try {
LOG.info("Initializing QueryInProgress for QueryID=" + queryId);
WorkerResourceManager resourceManager = masterContext.getResourceManager();
WorkerResource queryMasterResource = resourceManager.allocateQueryMaster(this);
if(queryMasterResource == null) {
return false;
}
queryInfo.setQueryMasterResource(queryMasterResource);
getEventHandler().handle(new QueryJobEvent(QueryJobEvent.Type.QUERY_MASTER_START, queryInfo));
return true;
} catch (Exception e) {
catchException(e);
return false;
}
}
示例3: makeQueryInfoFromHeartbeat
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
private QueryInfo makeQueryInfoFromHeartbeat(TajoMasterProtocol.TajoHeartbeat queryHeartbeat) {
QueryInfo queryInfo = new QueryInfo(new QueryId(queryHeartbeat.getQueryId()));
if (queryHeartbeat.getTajoWorkerHost() != null) {
WorkerResource queryMasterResource = new WorkerResource();
queryMasterResource.setAllocatedHost(queryHeartbeat.getTajoWorkerHost());
queryMasterResource.setPeerRpcPort(queryHeartbeat.getPeerRpcPort());
queryMasterResource.setQueryMasterPort(queryHeartbeat.getTajoQueryMasterPort());
queryMasterResource.setClientPort(queryHeartbeat.getTajoWorkerClientPort());
queryMasterResource.setPullServerPort(queryHeartbeat.getTajoWorkerPullServerPort());
queryInfo.setQueryMasterResource(queryMasterResource);
}
queryInfo.setLastMessage(queryHeartbeat.getStatusMessage());
queryInfo.setQueryState(queryHeartbeat.getState());
queryInfo.setProgress(queryHeartbeat.getQueryProgress());
if (queryHeartbeat.hasQueryFinishTime()) {
queryInfo.setFinishTime(queryHeartbeat.getQueryFinishTime());
}
return queryInfo;
}
示例4: getAllWorkerResource
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
@Override
public void getAllWorkerResource(RpcController controller, PrimitiveProtos.NullProto request,
RpcCallback<TajoMasterProtocol.WorkerResourcesRequest> done) {
TajoMasterProtocol.WorkerResourcesRequest.Builder builder =
TajoMasterProtocol.WorkerResourcesRequest.newBuilder();
List<WorkerResource> workerResources =
new ArrayList<WorkerResource>(context.getResourceManager().getWorkers().values());
for(WorkerResource worker: workerResources) {
TajoMasterProtocol.WorkerResourceProto.Builder workerResource =
TajoMasterProtocol.WorkerResourceProto.newBuilder();
workerResource.setHost(worker.getAllocatedHost());
workerResource.setPeerRpcPort(worker.getPeerRpcPort());
workerResource.setInfoPort(worker.getHttpPort());
workerResource.setQueryMasterPort(worker.getQueryMasterPort());
workerResource.setMemoryMB(worker.getMemoryMB());
workerResource.setDiskSlots(worker.getDiskSlots());
workerResource.setQueryMasterPort(worker.getQueryMasterPort());
builder.addWorkerResources(workerResource);
}
done.run(builder.build());
}
示例5: getNumWorkers
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
protected int getNumWorkers(WorkerStatus status) {
int numWorkers = 0;
for(WorkerResource eachWorker: tajoMasterContext.getResourceManager().getWorkers().values()) {
if(eachWorker.getWorkerStatus() == status) {
numWorkers++;
}
}
return numWorkers;
}
示例6: testHeartbeat
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
@Test
public void testHeartbeat() throws Exception {
TajoWorkerResourceManager tajoWorkerResourceManager = initResourceManager(false);
assertEquals(numWorkers, tajoWorkerResourceManager.getWorkers().size());
for(WorkerResource eachWorker: tajoWorkerResourceManager.getWorkers().values()) {
assertEquals(workerMemoryMB, eachWorker.getAvailableMemoryMB());
assertEquals(workerDiskSlots, eachWorker.getAvailableDiskSlots(), 0);
}
tajoWorkerResourceManager.stop();
}
示例7: getClusterInfo
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
@Override
public GetClusterInfoResponse getClusterInfo(RpcController controller,
GetClusterInfoRequest request)
throws ServiceException {
GetClusterInfoResponse.Builder builder
= GetClusterInfoResponse.newBuilder();
Map<String, Worker> workers = context.getResourceManager().getWorkers();
List<String> wokerKeys = new ArrayList<String>(workers.keySet());
Collections.sort(wokerKeys);
WorkerResourceInfo.Builder workerBuilder
= WorkerResourceInfo.newBuilder();
for(Worker worker: workers.values()) {
WorkerResource workerResource = worker.getResource();
workerBuilder.setAllocatedHost(worker.getHostName());
workerBuilder.setDiskSlots(workerResource.getDiskSlots());
workerBuilder.setCpuCoreSlots(workerResource.getCpuCoreSlots());
workerBuilder.setMemoryMB(workerResource.getMemoryMB());
workerBuilder.setLastHeartbeat(worker.getLastHeartbeatTime());
workerBuilder.setUsedMemoryMB(workerResource.getUsedMemoryMB());
workerBuilder.setUsedCpuCoreSlots(workerResource.getUsedCpuCoreSlots());
workerBuilder.setUsedDiskSlots(workerResource.getUsedDiskSlots());
workerBuilder.setWorkerStatus(worker.getState().toString());
workerBuilder.setQueryMasterMode(workerResource.isQueryMasterMode());
workerBuilder.setTaskRunnerMode(workerResource.isTaskRunnerMode());
workerBuilder.setPeerRpcPort(worker.getPeerRpcPort());
workerBuilder.setQueryMasterPort(worker.getQueryMasterPort());
workerBuilder.setClientPort(worker.getClientPort());
workerBuilder.setPullServerPort(worker.getPullServerPort());
workerBuilder.setHttpPort(worker.getHttpPort());
workerBuilder.setMaxHeap(workerResource.getMaxHeap());
workerBuilder.setFreeHeap(workerResource.getFreeHeap());
workerBuilder.setTotalHeap(workerResource.getTotalHeap());
workerBuilder.setNumRunningTasks(workerResource.getNumRunningTasks());
workerBuilder.setNumQueryMasterTasks(workerResource.getNumQueryMasterTasks());
builder.addWorkerList(workerBuilder.build());
}
return builder.build();
}
示例8: setQueryMasterResource
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
public void setQueryMasterResource(WorkerResource queryMasterResource) {
this.queryMasterResource = queryMasterResource;
}
示例9: getQueryMasterResource
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
public WorkerResource getQueryMasterResource() {
return queryMasterResource;
}
示例10: getClusterInfo
import org.apache.tajo.master.rm.WorkerResource; //導入依賴的package包/類
@Override
public GetClusterInfoResponse getClusterInfo(RpcController controller,
GetClusterInfoRequest request)
throws ServiceException {
GetClusterInfoResponse.Builder builder
= GetClusterInfoResponse.newBuilder();
Map<String, WorkerResource> workers
= context.getResourceManager().getWorkers();
List<String> wokerKeys = new ArrayList<String>(workers.keySet());
Collections.sort(wokerKeys);
int runningQueryMasterTasks = 0;
WorkerResourceInfo.Builder workerBuilder
= WorkerResourceInfo.newBuilder();
for(WorkerResource eachWorker: workers.values()) {
workerBuilder.setAllocatedHost(eachWorker.getAllocatedHost());
workerBuilder.setDiskSlots(eachWorker.getDiskSlots());
workerBuilder.setCpuCoreSlots(eachWorker.getCpuCoreSlots());
workerBuilder.setMemoryMB(eachWorker.getMemoryMB());
workerBuilder.setLastHeartbeat(eachWorker.getLastHeartbeat());
workerBuilder.setUsedMemoryMB(eachWorker.getUsedMemoryMB());
workerBuilder.setUsedCpuCoreSlots(eachWorker.getUsedCpuCoreSlots());
workerBuilder.setUsedDiskSlots(eachWorker.getUsedDiskSlots());
workerBuilder.setWorkerStatus(eachWorker.getWorkerStatus().toString());
workerBuilder.setQueryMasterMode(eachWorker.isQueryMasterMode());
workerBuilder.setTaskRunnerMode(eachWorker.isTaskRunnerMode());
workerBuilder.setPeerRpcPort(eachWorker.getPeerRpcPort());
workerBuilder.setQueryMasterPort(eachWorker.getQueryMasterPort());
workerBuilder.setClientPort(eachWorker.getClientPort());
workerBuilder.setPullServerPort(eachWorker.getPullServerPort());
workerBuilder.setHttpPort(eachWorker.getHttpPort());
workerBuilder.setMaxHeap(eachWorker.getMaxHeap());
workerBuilder.setFreeHeap(eachWorker.getFreeHeap());
workerBuilder.setTotalHeap(eachWorker.getTotalHeap());
workerBuilder.setNumRunningTasks(eachWorker.getNumRunningTasks());
workerBuilder.setNumQueryMasterTasks(eachWorker.getNumQueryMasterTasks());
builder.addWorkerList(workerBuilder.build());
}
return builder.build();
}