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


Java Records.newRecord方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.util.Records.newRecord方法的典型用法代码示例。如果您正苦于以下问题:Java Records.newRecord方法的具体用法?Java Records.newRecord怎么用?Java Records.newRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.util.Records的用法示例。


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

示例1: 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

示例2: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static QueueInfo newInstance(String queueName, float capacity,
    float maximumCapacity, float currentCapacity,
    List<QueueInfo> childQueues, List<ApplicationReport> applications,
    QueueState queueState, Set<String> accessibleNodeLabels,
    String defaultNodeLabelExpression) {
  QueueInfo queueInfo = Records.newRecord(QueueInfo.class);
  queueInfo.setQueueName(queueName);
  queueInfo.setCapacity(capacity);
  queueInfo.setMaximumCapacity(maximumCapacity);
  queueInfo.setCurrentCapacity(currentCapacity);
  queueInfo.setChildQueues(childQueues);
  queueInfo.setApplications(applications);
  queueInfo.setQueueState(queueState);
  queueInfo.setAccessibleNodeLabels(accessibleNodeLabels);
  queueInfo.setDefaultNodeLabelExpression(defaultNodeLabelExpression);
  return queueInfo;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:QueueInfo.java

示例3: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static NodeReport newInstance(NodeId nodeId, NodeState nodeState,
    String httpAddress, String rackName, Resource used, Resource capability,
    int numContainers, String healthReport, long lastHealthReportTime,
    Set<String> nodeLabels) {
  NodeReport nodeReport = Records.newRecord(NodeReport.class);
  nodeReport.setNodeId(nodeId);
  nodeReport.setNodeState(nodeState);
  nodeReport.setHttpAddress(httpAddress);
  nodeReport.setRackName(rackName);
  nodeReport.setUsed(used);
  nodeReport.setCapability(capability);
  nodeReport.setNumContainers(numContainers);
  nodeReport.setHealthReport(healthReport);
  nodeReport.setLastHealthReportTime(lastHealthReportTime);
  nodeReport.setNodeLabels(nodeLabels);
  return nodeReport;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:NodeReport.java

示例4: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static ContainerReport newInstance(ContainerId containerId,
    Resource allocatedResource, NodeId assignedNode, Priority priority,
    long creationTime, long finishTime, String diagnosticInfo, String logUrl,
    int containerExitStatus, ContainerState containerState,
    String nodeHttpAddress) {
  ContainerReport report = Records.newRecord(ContainerReport.class);
  report.setContainerId(containerId);
  report.setAllocatedResource(allocatedResource);
  report.setAssignedNode(assignedNode);
  report.setPriority(priority);
  report.setCreationTime(creationTime);
  report.setFinishTime(finishTime);
  report.setDiagnosticsInfo(diagnosticInfo);
  report.setLogUrl(logUrl);
  report.setContainerExitStatus(containerExitStatus);
  report.setContainerState(containerState);
  report.setNodeHttpAddress(nodeHttpAddress);
  return report;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:ContainerReport.java

示例5: cancelDelegationToken

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Override
public CancelDelegationTokenResponse cancelDelegationToken(
    CancelDelegationTokenRequest request) throws YarnException {
  try {
    if (!isAllowedDelegationTokenOp()) {
      throw new IOException(
          "Delegation Token can be cancelled only with kerberos authentication");
    }
    org.apache.hadoop.yarn.api.records.Token protoToken = request.getDelegationToken();
    Token<RMDelegationTokenIdentifier> token = new Token<RMDelegationTokenIdentifier>(
        protoToken.getIdentifier().array(), protoToken.getPassword().array(),
        new Text(protoToken.getKind()), new Text(protoToken.getService()));

    String user = UserGroupInformation.getCurrentUser().getUserName();
    rmDTSecretManager.cancelToken(token, user);
    return Records.newRecord(CancelDelegationTokenResponse.class);
  } catch (IOException e) {
    throw RPCUtil.getRemoteException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ClientRMService.java

示例6: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static RefreshServiceAclsResponse newInstance() {
  RefreshServiceAclsResponse response =
      Records.newRecord(RefreshServiceAclsResponse.class);
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:RefreshServiceAclsResponse.java

示例7: newContainerId

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static ContainerId newContainerId(ApplicationAttemptId appAttemptId,
    long containerId) {
  ContainerId id = Records.newRecord(ContainerId.class);
  id.setContainerId(containerId);
  id.setApplicationAttemptId(appAttemptId);
  id.build();
  return id;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:ContainerId.java

示例8: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static Token newInstance(byte[] identifier, String kind, byte[] password,
    String service) {
  Token token = Records.newRecord(Token.class);
  token.setIdentifier(ByteBuffer.wrap(identifier));
  token.setKind(kind);
  token.setPassword(ByteBuffer.wrap(password));
  token.setService(service);
  return token;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:Token.java

示例9: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
public static ResourceOption newInstance(Resource resource,
    int overCommitTimeout){
  ResourceOption resourceOption = Records.newRecord(ResourceOption.class);
  resourceOption.setResource(resource);
  resourceOption.setOverCommitTimeout(overCommitTimeout);
  resourceOption.build();
  return resourceOption;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:ResourceOption.java

示例10: nodeHeartbeat

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
public NodeHeartbeatResponse nodeHeartbeat(Map<ApplicationId,
    List<ContainerStatus>> conts, boolean isHealthy, int resId) throws Exception {
  NodeHeartbeatRequest req = Records.newRecord(NodeHeartbeatRequest.class);
  NodeStatus status = Records.newRecord(NodeStatus.class);
  status.setResponseId(resId);
  status.setNodeId(nodeId);
  for (Map.Entry<ApplicationId, List<ContainerStatus>> entry : conts.entrySet()) {
    Log.info("entry.getValue() " + entry.getValue());
    status.setContainersStatuses(entry.getValue());
  }
  NodeHealthStatus healthStatus = Records.newRecord(NodeHealthStatus.class);
  healthStatus.setHealthReport("");
  healthStatus.setIsNodeHealthy(isHealthy);
  healthStatus.setLastHealthReportTime(1);
  status.setNodeHealthStatus(healthStatus);
  req.setNodeStatus(status);
  req.setLastKnownContainerTokenMasterKey(this.currentContainerTokenMasterKey);
  req.setLastKnownNMTokenMasterKey(this.currentNMTokenMasterKey);
  NodeHeartbeatResponse heartbeatResponse =
      resourceTracker.nodeHeartbeat(req);
  
  MasterKey masterKeyFromRM = heartbeatResponse.getContainerTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentContainerTokenMasterKey
          .getKeyId()) {
    this.currentContainerTokenMasterKey = masterKeyFromRM;
  }

  masterKeyFromRM = heartbeatResponse.getNMTokenMasterKey();
  if (masterKeyFromRM != null
      && masterKeyFromRM.getKeyId() != this.currentNMTokenMasterKey
          .getKeyId()) {
    this.currentNMTokenMasterKey = masterKeyFromRM;
  }
  
  return heartbeatResponse;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:MockNM.java

示例11: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
/**
 * <p>
 * The request from clients to get a report of Applications matching the
 * giving application types in the cluster from the
 * <code>ResourceManager</code>.
 * </p>
 *
 * @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
 *
 * <p>Setting any of the parameters to null, would just disable that
 * filter</p>
 *
 * @param scope {@link ApplicationsRequestScope} to filter by
 * @param users list of users to filter by
 * @param queues list of scheduler queues to filter by
 * @param applicationTypes types of applications
 * @param applicationTags application tags to filter by
 * @param applicationStates application states to filter by
 * @param startRange range of application start times to filter by
 * @param finishRange range of application finish times to filter by
 * @param limit number of applications to limit to
 * @return {@link GetApplicationsRequest} to be used with
 * {@link ApplicationClientProtocol#getApplications(GetApplicationsRequest)}
 */
@Public
@Stable
public static GetApplicationsRequest newInstance(
    ApplicationsRequestScope scope,
    Set<String> users,
    Set<String> queues,
    Set<String> applicationTypes,
    Set<String> applicationTags,
    EnumSet<YarnApplicationState> applicationStates,
    LongRange startRange,
    LongRange finishRange,
    Long limit) {
  GetApplicationsRequest request =
      Records.newRecord(GetApplicationsRequest.class);
  if (scope != null) {
    request.setScope(scope);
  }
  request.setUsers(users);
  request.setQueues(queues);
  request.setApplicationTypes(applicationTypes);
  request.setApplicationTags(applicationTags);
  request.setApplicationStates(applicationStates);
  if (startRange != null) {
    request.setStartRange(
        startRange.getMinimumLong(), startRange.getMaximumLong());
  }
  if (finishRange != null) {
    request.setFinishRange(
        finishRange.getMinimumLong(), finishRange.getMaximumLong());
  }
  if (limit != null) {
    request.setLimit(limit);
  }
  return request;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:60,代码来源:GetApplicationsRequest.java

示例12: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Public
public static ContainerResourceIncreaseRequest newInstance(
    ContainerId existingContainerId, Resource targetCapability) {
  ContainerResourceIncreaseRequest context = Records
      .newRecord(ContainerResourceIncreaseRequest.class);
  context.setContainerId(existingContainerId);
  context.setCapability(targetCapability);
  return context;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ContainerResourceIncreaseRequest.java

示例13: FakeSchedulable

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
public FakeSchedulable(Resource minShare, Resource maxShare,
    ResourceWeights weight, Resource fairShare, Resource usage, long startTime) {
  this.minShare = minShare;
  this.maxShare = maxShare;
  this.weights = weight;
  setFairShare(fairShare);
  this.usage = usage;
  this.priority = Records.newRecord(Priority.class);
  this.startTime = startTime;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:FakeSchedulable.java

示例14: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Private
@Unstable
public static RenewDelegationTokenResponse newInstance(long expTime) {
  RenewDelegationTokenResponse response =
      Records.newRecord(RenewDelegationTokenResponse.class);
  response.setNextExpirationTime(expTime);
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:RenewDelegationTokenResponse.java

示例15: newInstance

import org.apache.hadoop.yarn.util.Records; //导入方法依赖的package包/类
@Public
@Stable 
public static KillApplicationRequest newInstance(ApplicationId applicationId) {
  KillApplicationRequest request =
      Records.newRecord(KillApplicationRequest.class);
  request.setApplicationId(applicationId);
  return request;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:KillApplicationRequest.java


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