当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationIdUtils类代码示例

本文整理汇总了Java中org.apache.tajo.util.ApplicationIdUtils的典型用法代码示例。如果您正苦于以下问题:Java ApplicationIdUtils类的具体用法?Java ApplicationIdUtils怎么用?Java ApplicationIdUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationIdUtils类属于org.apache.tajo.util包,在下文中一共展示了ApplicationIdUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stopQueryMaster

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
@Override
public void stopQueryMaster(QueryId queryId) {
  try {
    FinalApplicationStatus appStatus = FinalApplicationStatus.UNDEFINED;
    QueryInProgress queryInProgress = masterContext.getQueryJobManager().getQueryInProgress(queryId);
    if(queryInProgress == null) {
      return;
    }
    TajoProtos.QueryState state = queryInProgress.getQueryInfo().getQueryState();
    if (state == TajoProtos.QueryState.QUERY_SUCCEEDED) {
      appStatus = FinalApplicationStatus.SUCCEEDED;
    } else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
      appStatus = FinalApplicationStatus.FAILED;
    } else if (state == TajoProtos.QueryState.QUERY_ERROR) {
      appStatus = FinalApplicationStatus.FAILED;
    }
    FinishApplicationMasterRequest request = recordFactory
        .newRecordInstance(FinishApplicationMasterRequest.class);
    request.setAppAttemptId(ApplicationIdUtils.createApplicationAttemptId(queryId));
    request.setFinishApplicationStatus(appStatus);
    request.setDiagnostics("QueryMaster shutdown by TajoMaster.");
    rmClient.finishApplicationMaster(request);
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:27,代码来源:YarnTajoResourceManager.java

示例2: isQueryMasterStopped

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
public boolean isQueryMasterStopped(QueryId queryId) {
  ApplicationId appId = ApplicationIdUtils.queryIdToAppId(queryId);
  try {
    ApplicationReport report = yarnClient.getApplicationReport(appId);
    YarnApplicationState state = report.getYarnApplicationState();
    return EnumSet.of(
        YarnApplicationState.FINISHED,
        YarnApplicationState.KILLED,
        YarnApplicationState.FAILED).contains(state);
  } catch (YarnRemoteException e) {
    LOG.error(e.getMessage(), e);
    return false;
  }
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:15,代码来源:YarnTajoResourceManager.java

示例3: YarnRMContainerAllocator

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
public YarnRMContainerAllocator(QueryMasterTask.QueryMasterTaskContext context) {
  super();
  this.context = context;
  this.appAttemptId = ApplicationIdUtils.createApplicationAttemptId(context.getQueryId());
  this.eventHandler = context.getDispatcher().getEventHandler();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:7,代码来源:YarnRMContainerAllocator.java

示例4: run

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
@Override
public void run() {
  LOG.info("WorkerResourceAllocationThread start");
  while(!stopped.get()) {
    try {
      WorkerResourceRequest resourceRequest = requestQueue.take();

      if (LOG.isDebugEnabled()) {
        LOG.debug("allocateWorkerResources:" +
            (new QueryId(resourceRequest.request.getQueryId())) +
            ", requiredMemory:" + resourceRequest.request.getMinMemoryMBPerContainer() +
            "~" + resourceRequest.request.getMaxMemoryMBPerContainer() +
            ", requiredContainers:" + resourceRequest.request.getNumContainers() +
            ", requiredDiskSlots:" + resourceRequest.request.getMinDiskSlotPerContainer() +
            "~" + resourceRequest.request.getMaxDiskSlotPerContainer() +
            ", queryMasterRequest=" + resourceRequest.queryMasterRequest +
            ", liveWorkers=" + rmContext.getWorkers().size());
      }

      List<AllocatedWorkerResource> allocatedWorkerResources = chooseWorkers(resourceRequest);

      if(allocatedWorkerResources.size() > 0) {
        List<WorkerAllocatedResource> allocatedResources =
            new ArrayList<WorkerAllocatedResource>();

        for(AllocatedWorkerResource allocatedResource: allocatedWorkerResources) {
          NodeId nodeId = NodeId.newInstance(allocatedResource.worker.getHostName(),
              allocatedResource.worker.getPeerRpcPort());

          TajoWorkerContainerId containerId = new TajoWorkerContainerId();

          containerId.setApplicationAttemptId(
              ApplicationIdUtils.createApplicationAttemptId(resourceRequest.queryId));
          containerId.setId(containerIdSeq.incrementAndGet());

          ContainerIdProto containerIdProto = containerId.getProto();
          allocatedResources.add(WorkerAllocatedResource.newBuilder()
              .setContainerId(containerIdProto)
              .setNodeId(nodeId.toString())
              .setWorkerHost(allocatedResource.worker.getHostName())
              .setQueryMasterPort(allocatedResource.worker.getQueryMasterPort())
              .setClientPort(allocatedResource.worker.getClientPort())
              .setPeerRpcPort(allocatedResource.worker.getPeerRpcPort())
              .setWorkerPullServerPort(allocatedResource.worker.getPullServerPort())
              .setAllocatedMemoryMB(allocatedResource.allocatedMemoryMB)
              .setAllocatedDiskSlots(allocatedResource.allocatedDiskSlots)
              .build());


          allocatedResourceMap.putIfAbsent(containerIdProto, allocatedResource);
        }

        resourceRequest.callBack.run(WorkerResourceAllocationResponse.newBuilder()
            .setQueryId(resourceRequest.request.getQueryId())
            .addAllWorkerAllocatedResource(allocatedResources)
            .build()
        );

      } else {
        if(LOG.isDebugEnabled()) {
          LOG.debug("=========================================");
          LOG.debug("Available Workers");
          for(String liveWorker: rmContext.getWorkers().keySet()) {
            LOG.debug(rmContext.getWorkers().get(liveWorker).toString());
          }
          LOG.debug("=========================================");
        }
        requestQueue.put(resourceRequest);
        Thread.sleep(100);
      }
    } catch(InterruptedException ie) {
      LOG.error(ie);
    }
  }
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:76,代码来源:TajoWorkerResourceManager.java

示例5: getFileCacheDir

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
public String getFileCacheDir() {
  fileCache = USERCACHE + "/" + "hyunsik" + "/" + APPCACHE + "/" +
      ConverterUtils.toString(ApplicationIdUtils.queryIdToAppId(taskId.getQueryUnitId().getExecutionBlockId().getQueryId())) +
      "/" + "output";
  return fileCache;
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:7,代码来源:Task.java

示例6: YarnRMContainerAllocator

import org.apache.tajo.util.ApplicationIdUtils; //导入依赖的package包/类
public YarnRMContainerAllocator(QueryMasterTask.QueryMasterTaskContext context) {
  super(ApplicationIdUtils.createApplicationAttemptId(context.getQueryId()));
  this.context = context;
  this.eventHandler = context.getDispatcher().getEventHandler();
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:6,代码来源:YarnRMContainerAllocator.java


注:本文中的org.apache.tajo.util.ApplicationIdUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。