當前位置: 首頁>>代碼示例>>Java>>正文


Java TajoWorkerResourceManager類代碼示例

本文整理匯總了Java中org.apache.tajo.master.rm.TajoWorkerResourceManager的典型用法代碼示例。如果您正苦於以下問題:Java TajoWorkerResourceManager類的具體用法?Java TajoWorkerResourceManager怎麽用?Java TajoWorkerResourceManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TajoWorkerResourceManager類屬於org.apache.tajo.master.rm包,在下文中一共展示了TajoWorkerResourceManager類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPropertiesAndConfigs

import org.apache.tajo.master.rm.TajoWorkerResourceManager; //導入依賴的package包/類
void initPropertiesAndConfigs() {
  if (System.getProperty(ConfVars.RESOURCE_MANAGER_CLASS.varname) != null) {
    String testResourceManager = System.getProperty(ConfVars.RESOURCE_MANAGER_CLASS.varname);
    Preconditions.checkState(
        testResourceManager.equals(TajoWorkerResourceManager.class.getCanonicalName()) ||
            testResourceManager.equals(YarnTajoResourceManager.class.getCanonicalName()),
        ConfVars.RESOURCE_MANAGER_CLASS.varname + " must be either " + TajoWorkerResourceManager.class.getCanonicalName() + " or " +
            YarnTajoResourceManager.class.getCanonicalName() +"."
    );
    conf.set(ConfVars.RESOURCE_MANAGER_CLASS.varname, System.getProperty(ConfVars.RESOURCE_MANAGER_CLASS.varname));
  }
  conf.setInt(ConfVars.WORKER_RESOURCE_AVAILABLE_MEMORY_MB.varname, 1024);
  conf.setFloat(ConfVars.WORKER_RESOURCE_AVAILABLE_DISKS.varname, 2.0f);

  this.standbyWorkerMode = conf.getVar(ConfVars.RESOURCE_MANAGER_CLASS)
      .indexOf(TajoWorkerResourceManager.class.getName()) >= 0;
  conf.set(CommonTestingUtil.TAJO_TEST, "TRUE");
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:19,代碼來源:TajoTestingCluster.java

示例2: initResourceManager

import org.apache.tajo.master.rm.TajoWorkerResourceManager; //導入依賴的package包/類
private void initResourceManager() throws Exception {
  Class<WorkerResourceManager>  resourceManagerClass = (Class<WorkerResourceManager>)
      systemConf.getClass(ConfVars.RESOURCE_MANAGER_CLASS.varname, TajoWorkerResourceManager.class);
  Constructor<WorkerResourceManager> constructor = resourceManagerClass.getConstructor(MasterContext.class);
  resourceManager = constructor.newInstance(context);
  addIfService(resourceManager);
}
 
開發者ID:apache,項目名稱:incubator-tajo,代碼行數:8,代碼來源:TajoMaster.java

示例3: initResourceManager

import org.apache.tajo.master.rm.TajoWorkerResourceManager; //導入依賴的package包/類
private void initResourceManager() throws Exception {
  Class<WorkerResourceManager>  resourceManagerClass = (Class<WorkerResourceManager>)
      systemConf.getClass(ConfVars.RESOURCE_MANAGER_CLASS.varname, TajoWorkerResourceManager.class);
  Constructor<WorkerResourceManager> constructor = resourceManagerClass.getConstructor(MasterContext.class);
  resourceManager = constructor.newInstance(context);
  resourceManager.init(context.getConf());
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:8,代碼來源:TajoMaster.java

示例4: testHeartbeat

import org.apache.tajo.master.rm.TajoWorkerResourceManager; //導入依賴的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();
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:11,代碼來源:TestTajoResourceManager.java

示例5: initResourceManager

import org.apache.tajo.master.rm.TajoWorkerResourceManager; //導入依賴的package包/類
private TajoWorkerResourceManager initResourceManager(boolean queryMasterMode) throws Exception {
  tajoConf = new org.apache.tajo.conf.TajoConf();

  tajoConf.setFloatVar(TajoConf.ConfVars.TAJO_QUERYMASTER_DISK_SLOT, 0.0f);
  tajoConf.setIntVar(TajoConf.ConfVars.TAJO_QUERYMASTER_MEMORY_MB, 512);

  TajoWorkerResourceManager tajoWorkerResourceManager = new TajoWorkerResourceManager(tajoConf);

  for(int i = 0; i < numWorkers; i++) {
    ServerStatusProto.System system = ServerStatusProto.System.newBuilder()
        .setAvailableProcessors(1)
        .setFreeMemoryMB(workerMemoryMB)
        .setMaxMemoryMB(workerMemoryMB)
        .setTotalMemoryMB(workerMemoryMB)
        .build();

    ServerStatusProto.JvmHeap jvmHeap = ServerStatusProto.JvmHeap.newBuilder()
        .setFreeHeap(workerMemoryMB)
        .setMaxHeap(workerMemoryMB)
        .setTotalHeap(workerMemoryMB)
        .build();

    ServerStatusProto.Disk disk = ServerStatusProto.Disk.newBuilder()
        .setAbsolutePath("/")
        .setFreeSpace(0)
        .setTotalSpace(0)
        .setUsableSpace(0)
        .build();

    List<ServerStatusProto.Disk> disks = new ArrayList<ServerStatusProto.Disk>();

    disks.add(disk);

    ServerStatusProto serverStatus = ServerStatusProto.newBuilder()
        .setQueryMasterMode(queryMasterMode ? BOOL_TRUE : BOOL_FALSE)
        .setTaskRunnerMode(BOOL_TRUE)
        .setDiskSlots(workerDiskSlots)
        .setMemoryResourceMB(workerMemoryMB)
        .setJvmHeap(jvmHeap)
        .setSystem(system)
        .addAllDisk(disks)
        .setRunningTaskNum(0)
        .build();

    TajoHeartbeat tajoHeartbeat = TajoHeartbeat.newBuilder()
        .setTajoWorkerHost("host" + (i + 1))
        .setQueryId(QueryIdFactory.newQueryId(queryIdTime, i + 1).getProto())
        .setTajoQueryMasterPort(21000)
        .setPeerRpcPort(29000 + i)
        .setTajoWorkerHttpPort(28080 + i)
        .setServerStatus(serverStatus)
        .build();

    tajoWorkerResourceManager.workerHeartbeat(tajoHeartbeat);
  }

  return tajoWorkerResourceManager;
}
 
開發者ID:gruter,項目名稱:tajo-cdh,代碼行數:59,代碼來源:TestTajoResourceManager.java


注:本文中的org.apache.tajo.master.rm.TajoWorkerResourceManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。