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


Java Records類代碼示例

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


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

示例1: newResourceLocalizationSpec

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
public static ResourceLocalizationSpec newResourceLocalizationSpec(
    LocalResource rsrc, Path path) {
  URL local = ConverterUtils.getYarnUrlFromPath(path);
  ResourceLocalizationSpec resourceLocalizationSpec =
      Records.newRecord(ResourceLocalizationSpec.class);
  resourceLocalizationSpec.setDestinationDirectory(local);
  resourceLocalizationSpec.setResource(rsrc);
  return resourceLocalizationSpec;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:10,代碼來源:NodeManagerBuilderUtils.java

示例2: allocate

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
@Override
public AllocateResponse allocate(AllocateRequest request)
    throws YarnException, IOException {
  HPCAllocateRequest allocateRequest = new HPCAllocateRequest();
  allocateRequest.setAppProgress(request.getProgress());
  allocateRequest.setContainersToBeReleased(request.getReleaseList());
  allocateRequest.setResourceAsk(request.getAskList());
  allocateRequest.setResourceBlacklistRequest(request
      .getResourceBlacklistRequest());
  allocateRequest.setResponseID(request.getResponseId());
  HPCAllocateResponse hpcAllocateResponse = applicationMaster
      .allocate(allocateRequest);

  AllocateResponse response = Records.newRecord(AllocateResponse.class);
  response.setAllocatedContainers(hpcAllocateResponse
      .getAllocatedContainers());
  response.setNMTokens(hpcAllocateResponse.getNmTokens());
  response.setCompletedContainersStatuses(hpcAllocateResponse.getCompletedContainers());
  return response;
}
 
開發者ID:intel-hpdd,項目名稱:scheduling-connector-for-hadoop,代碼行數:21,代碼來源:HPCApplicationMasterProtocolImpl.java

示例3: getCountersResponseFromHistoryServer

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:TestClientServiceDelegate.java

示例4: initNodeIds

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private void initNodeIds(int nodeNums, int containerNums, Resource resource) {
  Random portRandom = new Random();
  Random ipRandom = new Random();
  for (int i = 0; i < nodeNums; i++) {
    NodeReport nodeReport = Records.newRecord(NodeReport.class);
    nodeReport.setNumContainers(containerNums);
    nodeReport.setNodeLabels(new HashSet<>());
    nodeReport.setNodeState(NodeState.RUNNING);
    nodeReport.setCapability(resource);
    nodeReport.setUsed(Resource.newInstance(0, 0));

    int port = 1024 + portRandom.nextInt(65535 - 1024 + 1);
    StringBuilder hostStr = new StringBuilder();
    for (int j = 0; j < 4; j++) {
      hostStr.append(".").append(ipRandom.nextInt(256));
    }
    NodeId nodeId = NodeId.newInstance(hostStr.substring(1), port);
    nodeReport.setNodeId(nodeId);
    nodeReport.setHttpAddress(nodeId.getHost());

    nodeReportList.add(nodeReport);
  }
}
 
開發者ID:Microsoft,項目名稱:pai,代碼行數:24,代碼來源:MockResourceManager.java

示例5: sendErrorMessage

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private void sendErrorMessage() throws InterruptedException {
  List<TaskState> stateList = Arrays.asList(
      TaskState.CONTAINER_ALLOCATED, TaskState.CONTAINER_LAUNCHED, TaskState.CONTAINER_RUNNING);
  List<TaskStatus> list = statusManager.getTaskStatus(new HashSet<>(stateList));
  while (list.size() < taskNum) {
    Thread.sleep(2000);
    list = statusManager.getTaskStatus(new HashSet<>(stateList));
  }

  String containerIdStr = list.get(0).getContainerId();
  ContainerId containerId = ConverterUtils.toContainerId(containerIdStr);

  ContainerStatus status = Records.newRecord(ContainerStatus.class);
  status.setContainerId(containerId);
  status.setState(ContainerState.COMPLETE);
  status.setExitStatus(ExitStatusKey.SUCCEEDED.toInt());
  onContainersCompleted(Collections.singletonList(status));
}
 
開發者ID:Microsoft,項目名稱:pai,代碼行數:19,代碼來源:KillAllOnAnyCompletedTest.java

示例6: newInstance

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
@Public
@Stable
public static ContainerLaunchContext newInstance(
    Map<String, LocalResource> localResources,
    Map<String, String> environment, List<String> commands,
    Map<String, ByteBuffer> serviceData,  ByteBuffer tokens,
    Map<ApplicationAccessType, String> acls) {
  ContainerLaunchContext container =
      Records.newRecord(ContainerLaunchContext.class);
  container.setLocalResources(localResources);
  container.setEnvironment(environment);
  container.setCommands(commands);
  container.setServiceData(serviceData);
  container.setTokens(tokens);
  container.setApplicationACLs(acls);
  return container;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:18,代碼來源:ContainerLaunchContext.java

示例7: submitTasks

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
/**
 * submit tasks to request containers for the tasks
 *
 * @param tasks
 *            a collection of tasks we want to ask container for
 */
private synchronized void submitTasks(Collection<TaskRecord> tasks) {
    for (TaskRecord r : tasks) {
        Resource resource = Records.newRecord(Resource.class);
        if (r.taskRole == "server") {
          resource.setMemory(serverMemoryMB);
          resource.setVirtualCores(serverCores);
        } else {
          resource.setMemory(workerMemoryMB);
          resource.setVirtualCores(workerCores);
        }
        Priority priority = Records.newRecord(Priority.class);
        priority.setPriority(this.appPriority);
        r.containerRequest = new ContainerRequest(resource, null, null,
                priority);
        rmClient.addContainerRequest(r.containerRequest);
        pendingTasks.add(r);
    }
}
 
開發者ID:Intel-bigdata,項目名稱:MXNetOnYARN,代碼行數:25,代碼來源:ApplicationMaster.java

示例8: newInstance

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
@Public
@Stable
public static AllocateRequest newInstance(int responseID, float appProgress,
    List<ResourceRequest> resourceAsk,
    List<ContainerId> containersToBeReleased,
    ResourceBlacklistRequest resourceBlacklistRequest,
    List<ContainerResourceIncreaseRequest> increaseRequests) {
  AllocateRequest allocateRequest = Records.newRecord(AllocateRequest.class);
  allocateRequest.setResponseId(responseID);
  allocateRequest.setProgress(appProgress);
  allocateRequest.setAskList(resourceAsk);
  allocateRequest.setReleaseList(containersToBeReleased);
  allocateRequest.setResourceBlacklistRequest(resourceBlacklistRequest);
  allocateRequest.setIncreaseRequests(increaseRequests);
  return allocateRequest;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:AllocateRequest.java

示例9: getNewTaskID

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private TaskId getNewTaskID() {
  TaskId taskId = Records.newRecord(TaskId.class);
  taskId.setId(++taskCounter);
  taskId.setJobId(jobId);
  taskId.setTaskType(mockTask.getType());    
  return taskId;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:8,代碼來源:TestTaskImpl.java

示例10: newInstance

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
public static AMRMTokenSecretManagerState newInstance(
    AMRMTokenSecretManagerState state) {
  AMRMTokenSecretManagerState data =
      Records.newRecord(AMRMTokenSecretManagerState.class);
  data.setCurrentMasterKey(state.getCurrentMasterKey());
  data.setNextMasterKey(state.getNextMasterKey());
  return data;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:9,代碼來源:AMRMTokenSecretManagerState.java

示例11: newInstance

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
    ApplicationId applicationId, String applicationName, String queue,
    ContainerLaunchContext amContainer, boolean isUnmanagedAM,
    boolean cancelTokensWhenComplete, int maxAppAttempts,
    String applicationType, boolean keepContainers,
    String appLabelExpression, ResourceRequest resourceRequest) {
  ApplicationSubmissionContext context =
      Records.newRecord(ApplicationSubmissionContext.class);
  context.setApplicationId(applicationId);
  context.setApplicationName(applicationName);
  context.setQueue(queue);
  context.setAMContainerSpec(amContainer);
  context.setUnmanagedAM(isUnmanagedAM);
  context.setCancelTokensWhenComplete(cancelTokensWhenComplete);
  context.setMaxAppAttempts(maxAppAttempts);
  context.setApplicationType(applicationType);
  context.setKeepContainersAcrossApplicationAttempts(keepContainers);
  context.setNodeLabelExpression(appLabelExpression);
  context.setAMContainerResourceRequest(resourceRequest);
  return context;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:ApplicationSubmissionContext.java

示例12: getDelegationToken

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private org.apache.hadoop.yarn.api.records.Token getDelegationToken(
    final UserGroupInformation loggedInUser,
    final ApplicationClientProtocol clientRMService, final String renewerString)
    throws IOException, InterruptedException {
  org.apache.hadoop.yarn.api.records.Token token = loggedInUser
      .doAs(new PrivilegedExceptionAction<org.apache.hadoop.yarn.api.records.Token>() {
        @Override
          public org.apache.hadoop.yarn.api.records.Token run()
              throws YarnException, IOException {
          GetDelegationTokenRequest request = Records
              .newRecord(GetDelegationTokenRequest.class);
          request.setRenewer(renewerString);
          return clientRMService.getDelegationToken(request)
              .getRMDelegationToken();
        }
      });
  return token;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:19,代碼來源:TestClientRMTokens.java

示例13: renewDelegationToken

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private long renewDelegationToken(final UserGroupInformation loggedInUser,
    final ApplicationClientProtocol clientRMService,
    final org.apache.hadoop.yarn.api.records.Token dToken)
    throws IOException, InterruptedException {
  long nextExpTime = loggedInUser.doAs(new PrivilegedExceptionAction<Long>() {
    @Override
    public Long run() throws YarnException, IOException {
      RenewDelegationTokenRequest request = Records
          .newRecord(RenewDelegationTokenRequest.class);
      request.setDelegationToken(dToken);
      return clientRMService.renewDelegationToken(request)
          .getNextExpirationTime();
    }
  });
  return nextExpTime;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:TestClientRMTokens.java

示例14: renewDelegationToken

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
@Override
public RenewDelegationTokenResponse renewDelegationToken(
    RenewDelegationTokenRequest request) throws IOException {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be renewed only with kerberos authentication");
    }

    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<MRDelegationTokenIdentifier> token =
        new Token<MRDelegationTokenIdentifier>(
            protoToken.getIdentifier().array(), protoToken.getPassword()
                .array(), new Text(protoToken.getKind()), new Text(
                protoToken.getService()));

    String user = UserGroupInformation.getCurrentUser().getShortUserName();
    long nextExpTime = jhsDTSecretManager.renewToken(token, user);
    RenewDelegationTokenResponse renewResponse = Records
        .newRecord(RenewDelegationTokenResponse.class);
    renewResponse.setNextExpirationTime(nextExpTime);
    return renewResponse;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:HistoryClientService.java

示例15: getDelegationToken

import org.apache.hadoop.yarn.util.Records; //導入依賴的package包/類
private Token getDelegationToken(
    final UserGroupInformation loggedInUser,
    final MRClientProtocol hsService, final String renewerString)
    throws IOException, InterruptedException {
  // Get the delegation token directly as it is a little difficult to setup
  // the kerberos based rpc.
  Token token = loggedInUser
      .doAs(new PrivilegedExceptionAction<Token>() {
        @Override
        public Token run() throws IOException {
          GetDelegationTokenRequest request = Records
              .newRecord(GetDelegationTokenRequest.class);
          request.setRenewer(renewerString);
          return hsService.getDelegationToken(request).getDelegationToken();
        }

      });
  return token;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:TestJHSSecurity.java


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