Java 类org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl 实例源码

项目:hadoop    文件:NMContainerStatusPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hadoop    文件:ContainerStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:aliyun-oss-hadoop-fs    文件:NMContainerStatusPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:aliyun-oss-hadoop-fs    文件:ContainerStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:big-c    文件:NMContainerStatusPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:big-c    文件:ContainerStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NMContainerStatusPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hops    文件:NMContainerStatusPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }

  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getResource())) {
    builder.setResource(convertToProtoFormat(this.resource));
  }

  if (this.priority != null) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hops    文件:ContainerStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hadoop-on-lustre2    文件:ContainerStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
项目:hadoop    文件:ContainerTokenIdentifier.java   
public ContainerTokenIdentifier(ContainerId containerID, String hostName,
    String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId,
    long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierProto.Builder builder = 
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:hadoop    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerId containerID,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:hadoop    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier,
    String message) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  ContainerIdPBImpl containerID = 
      (ContainerIdPBImpl)identifier.getContainerID();
  if (containerID != null) {
    builder.setContainerId(containerID.getProto());
  }
  builder.setNmHostAddr(identifier.getNmHostAddress());
  builder.setAppSubmitter(identifier.getApplicationSubmitter());

  ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource();
  if (resource != null) {
    builder.setResource(resource.getProto());
  }

  builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp());
  builder.setMasterKeyId(identifier.getMasterKeyId());
  builder.setRmIdentifier(identifier.getRMIdentifier());

  PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority();
  if (priority != null) {
    builder.setPriority(priority.getProto());
  }

  builder.setCreationTime(identifier.getCreationTime());
  builder.setMessage(message);

  LogAggregationContextPBImpl logAggregationContext = 
      (LogAggregationContextPBImpl)identifier.getLogAggregationContext();

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(logAggregationContext.getProto());
  }

  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:ContainerTokenIdentifier.java   
public ContainerTokenIdentifier(ContainerId containerID, String hostName,
    String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId,
    long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext, String nodeLabelExpression,
    ContainerType containerType, ExecutionType executionType) {
  ContainerTokenIdentifierProto.Builder builder =
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }

  if (nodeLabelExpression != null) {
    builder.setNodeLabelExpression(nodeLabelExpression);
  }
  builder.setContainerType(convertToProtoFormat(containerType));
  builder.setExecutionType(convertToProtoFormat(executionType));

  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerId containerID,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier,
    String message) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  ContainerIdPBImpl containerID = 
      (ContainerIdPBImpl)identifier.getContainerID();
  if (containerID != null) {
    builder.setContainerId(containerID.getProto());
  }
  builder.setNmHostAddr(identifier.getNmHostAddress());
  builder.setAppSubmitter(identifier.getApplicationSubmitter());

  ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource();
  if (resource != null) {
    builder.setResource(resource.getProto());
  }

  builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp());
  builder.setMasterKeyId(identifier.getMasterKeyId());
  builder.setRmIdentifier(identifier.getRMIdentifier());

  PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority();
  if (priority != null) {
    builder.setPriority(priority.getProto());
  }

  builder.setCreationTime(identifier.getCreationTime());
  builder.setMessage(message);

  LogAggregationContextPBImpl logAggregationContext = 
      (LogAggregationContextPBImpl)identifier.getLogAggregationContext();

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(logAggregationContext.getProto());
  }

  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:NMLeveldbStateStoreService.java   
private RecoveredContainerState loadContainerState(ContainerId containerId,
    LeveldbIterator iter, String keyPrefix) throws IOException {
  RecoveredContainerState rcs = new RecoveredContainerState();
  rcs.status = RecoveredContainerStatus.REQUESTED;
  while (iter.hasNext()) {
    Entry<byte[],byte[]> entry = iter.peekNext();
    String key = asString(entry.getKey());
    if (!key.startsWith(keyPrefix)) {
      break;
    }
    iter.next();

    String suffix = key.substring(keyPrefix.length()-1);  // start with '/'
    if (suffix.equals(CONTAINER_REQUEST_KEY_SUFFIX)) {
      rcs.startRequest = new StartContainerRequestPBImpl(
          StartContainerRequestProto.parseFrom(entry.getValue()));
    } else if (suffix.equals(CONTAINER_DIAGS_KEY_SUFFIX)) {
      rcs.diagnostics = asString(entry.getValue());
    } else if (suffix.equals(CONTAINER_LAUNCHED_KEY_SUFFIX)) {
      if (rcs.status == RecoveredContainerStatus.REQUESTED) {
        rcs.status = RecoveredContainerStatus.LAUNCHED;
      }
    } else if (suffix.equals(CONTAINER_KILLED_KEY_SUFFIX)) {
      rcs.killed = true;
    } else if (suffix.equals(CONTAINER_EXIT_CODE_KEY_SUFFIX)) {
      rcs.status = RecoveredContainerStatus.COMPLETED;
      rcs.exitCode = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX)) {
      rcs.capability = new ResourcePBImpl(
          ResourceProto.parseFrom(entry.getValue()));
    } else {
      throw new IOException("Unexpected container state key: " + key);
    }
  }
  return rcs;
}
项目:aliyun-oss-hadoop-fs    文件:NMLeveldbStateStoreService.java   
@Override
public void storeContainerResourceChanged(ContainerId containerId,
    Resource capability) throws IOException {
  String key = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
  try {
    // New value will overwrite old values for the same key
    db.put(bytes(key),
        ((ResourcePBImpl) capability).getProto().toByteArray());
  } catch (DBException e) {
    throw new IOException(e);
  }
}
项目:big-c    文件:ContainerTokenIdentifier.java   
public ContainerTokenIdentifier(ContainerId containerID, String hostName,
    String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId,
    long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierProto.Builder builder = 
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:big-c    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerId containerID,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:big-c    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier,
    String message) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  ContainerIdPBImpl containerID = 
      (ContainerIdPBImpl)identifier.getContainerID();
  if (containerID != null) {
    builder.setContainerId(containerID.getProto());
  }
  builder.setNmHostAddr(identifier.getNmHostAddress());
  builder.setAppSubmitter(identifier.getApplicationSubmitter());

  ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource();
  if (resource != null) {
    builder.setResource(resource.getProto());
  }

  builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp());
  builder.setMasterKeyId(identifier.getMasterKeyId());
  builder.setRmIdentifier(identifier.getRMIdentifier());

  PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority();
  if (priority != null) {
    builder.setPriority(priority.getProto());
  }

  builder.setCreationTime(identifier.getCreationTime());
  builder.setMessage(message);

  LogAggregationContextPBImpl logAggregationContext = 
      (LogAggregationContextPBImpl)identifier.getLogAggregationContext();

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(logAggregationContext.getProto());
  }

  proto = builder.build();
}
项目:hops    文件:ContainerTokenIdentifier.java   
public ContainerTokenIdentifier(ContainerId containerID, int containerVersion,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext, String nodeLabelExpression,
    ContainerType containerType, String appSubmitterFolder) {
  ContainerTokenIdentifierProto.Builder builder =
      ContainerTokenIdentifierProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setVersion(containerVersion);
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  builder.setAppSubmitterFolder(appSubmitterFolder);

  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }

  if (nodeLabelExpression != null) {
    builder.setNodeLabelExpression(nodeLabelExpression);
  }
  builder.setContainerType(convertToProtoFormat(containerType));

  proto = builder.build();
}
项目:hops    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerId containerID,
    String hostName, String appSubmitter, Resource r, long expiryTimeStamp,
    int masterKeyId, long rmIdentifier, Priority priority, long creationTime,
    LogAggregationContext logAggregationContext) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  if (containerID != null) {
    builder.setContainerId(((ContainerIdPBImpl)containerID).getProto());
  }
  builder.setNmHostAddr(hostName);
  builder.setAppSubmitter(appSubmitter);
  if (r != null) {
    builder.setResource(((ResourcePBImpl)r).getProto());
  }
  builder.setExpiryTimeStamp(expiryTimeStamp);
  builder.setMasterKeyId(masterKeyId);
  builder.setRmIdentifier(rmIdentifier);
  if (priority != null) {
    builder.setPriority(((PriorityPBImpl)priority).getProto());
  }
  builder.setCreationTime(creationTime);

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(
        ((LogAggregationContextPBImpl)logAggregationContext).getProto());
  }
  proto = builder.build();
}
项目:hops    文件:ContainerTokenIdentifierForTest.java   
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier,
    String message) {
  ContainerTokenIdentifierForTestProto.Builder builder =
      ContainerTokenIdentifierForTestProto.newBuilder();
  ContainerIdPBImpl containerID = 
      (ContainerIdPBImpl)identifier.getContainerID();
  if (containerID != null) {
    builder.setContainerId(containerID.getProto());
  }
  builder.setNmHostAddr(identifier.getNmHostAddress());
  builder.setAppSubmitter(identifier.getApplicationSubmitter());
  builder.setAppSubmitterFolder(identifier.getApplicationSubmitterFolder());

  ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource();
  if (resource != null) {
    builder.setResource(resource.getProto());
  }

  builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp());
  builder.setMasterKeyId(identifier.getMasterKeyId());
  builder.setRmIdentifier(identifier.getRMIdentifier());

  PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority();
  if (priority != null) {
    builder.setPriority(priority.getProto());
  }

  builder.setCreationTime(identifier.getCreationTime());
  builder.setMessage(message);

  LogAggregationContextPBImpl logAggregationContext = 
      (LogAggregationContextPBImpl)identifier.getLogAggregationContext();

  if (logAggregationContext != null) {
    builder.setLogAggregationContext(logAggregationContext.getProto());
  }

  proto = builder.build();
}
项目:hops    文件:NMLeveldbStateStoreService.java   
private RecoveredContainerState loadContainerState(ContainerId containerId,
    LeveldbIterator iter, String keyPrefix) throws IOException {
  RecoveredContainerState rcs = new RecoveredContainerState();
  rcs.status = RecoveredContainerStatus.REQUESTED;
  while (iter.hasNext()) {
    Entry<byte[],byte[]> entry = iter.peekNext();
    String key = asString(entry.getKey());
    if (!key.startsWith(keyPrefix)) {
      break;
    }
    iter.next();

    String suffix = key.substring(keyPrefix.length()-1);  // start with '/'
    if (suffix.equals(CONTAINER_REQUEST_KEY_SUFFIX)) {
      rcs.startRequest = new StartContainerRequestPBImpl(
          StartContainerRequestProto.parseFrom(entry.getValue()));
    } else if (suffix.equals(CONTAINER_VERSION_KEY_SUFFIX)) {
      rcs.version = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_DIAGS_KEY_SUFFIX)) {
      rcs.diagnostics = asString(entry.getValue());
    } else if (suffix.equals(CONTAINER_LAUNCHED_KEY_SUFFIX)) {
      if (rcs.status == RecoveredContainerStatus.REQUESTED) {
        rcs.status = RecoveredContainerStatus.LAUNCHED;
      }
    } else if (suffix.equals(CONTAINER_KILLED_KEY_SUFFIX)) {
      rcs.killed = true;
    } else if (suffix.equals(CONTAINER_EXIT_CODE_KEY_SUFFIX)) {
      rcs.status = RecoveredContainerStatus.COMPLETED;
      rcs.exitCode = Integer.parseInt(asString(entry.getValue()));
    } else if (suffix.equals(CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX)) {
      rcs.capability = new ResourcePBImpl(
          ResourceProto.parseFrom(entry.getValue()));
    } else {
      throw new IOException("Unexpected container state key: " + key);
    }
  }
  return rcs;
}
项目:hops    文件:NMLeveldbStateStoreService.java   
@Override
public void storeContainerResourceChanged(ContainerId containerId,
    int containerVersion, Resource capability) throws IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("storeContainerResourceChanged: containerId=" + containerId
        + ", capability=" + capability);
  }

  String keyResChng = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_RESOURCE_CHANGED_KEY_SUFFIX;
  String keyVersion = CONTAINERS_KEY_PREFIX + containerId.toString()
      + CONTAINER_VERSION_KEY_SUFFIX;
  try {
    WriteBatch batch = db.createWriteBatch();
    try {
      // New value will overwrite old values for the same key
      batch.put(bytes(keyResChng),
          ((ResourcePBImpl) capability).getProto().toByteArray());
      batch.put(bytes(keyVersion), bytes(Integer.toString(containerVersion)));
      db.write(batch);
    } finally {
      batch.close();
    }
  } catch (DBException e) {
    throw new IOException(e);
  }
}
项目:incubator-myriad    文件:OfferLifeCycleManagerTest.java   
@Before
public void setUp() throws Exception {
  NodeStore store = new NodeStore();
  NodeIdProto nodeId = NodeIdProto.newBuilder().setHost("localhost").setPort(8000).build();
  RMNode rmNode = new RMNodeImpl(new NodeIdPBImpl(nodeId), new MockRMContext(), "localhost", 8000, 8070, new NodeBase(),
          new ResourcePBImpl(), "1.0");
  SchedulerNode node = new FiCaSchedulerNode(rmNode, false);
  store.add(node);
  manager = new OfferLifecycleManager(store, new MyriadDriver(new MockSchedulerDriver()));
}
项目:hadoop    文件:ContainerTokenIdentifier.java   
public Resource getResource() {
  if (!proto.hasResource()) {
    return null;
  }
  return new ResourcePBImpl(proto.getResource());
}
项目:hadoop    文件:RegisterApplicationMasterResponsePBImpl.java   
private Resource convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}
项目:hadoop    文件:RegisterApplicationMasterResponsePBImpl.java   
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl)resource).getProto();
}
项目:hadoop    文件:GetNewApplicationResponsePBImpl.java   
private Resource convertFromProtoFormat(ResourceProto resource) {
 return new ResourcePBImpl(resource);
}
项目:hadoop    文件:GetNewApplicationResponsePBImpl.java   
private ResourceProto convertToProtoFormat(Resource resource) {
 return ((ResourcePBImpl)resource).getProto();
}
项目:hadoop    文件:AllocateResponsePBImpl.java   
private synchronized ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
项目:hadoop    文件:AllocateResponsePBImpl.java   
private synchronized ResourceProto convertToProtoFormat(Resource r) {
  return ((ResourcePBImpl) r).getProto();
}
项目:hadoop    文件:NMContainerStatusPBImpl.java   
private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
项目:hadoop    文件:NMContainerStatusPBImpl.java   
private ResourceProto convertToProtoFormat(Resource t) {
  return ((ResourcePBImpl) t).getProto();
}
项目:hadoop    文件:RegisterNodeManagerRequestPBImpl.java   
private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
项目:hadoop    文件:RegisterNodeManagerRequestPBImpl.java   
private ResourceProto convertToProtoFormat(Resource t) {
  return ((ResourcePBImpl)t).getProto();
}
项目:hadoop    文件:ContainerTokenIdentifierForTest.java   
public Resource getResource() {
  return new ResourcePBImpl(proto.getResource());
}
项目:hadoop    文件:ContainerStartDataPBImpl.java   
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl) resource).getProto();
}