Java Code Examples for org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl

The following examples show how to use org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ambari-metrics   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 6 votes vote down vote up
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));
  }
}
 
Example 2
Source Project: hadoop   Source File: NMContainerStatusPBImpl.java    License: Apache License 2.0 6 votes vote down vote up
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));
  }
}
 
Example 3
Source Project: hadoop   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 6 votes vote down vote up
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));
  }
}
 
Example 4
Source Project: big-c   Source File: NMContainerStatusPBImpl.java    License: Apache License 2.0 6 votes vote down vote up
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));
  }
}
 
Example 5
Source Project: big-c   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 6 votes vote down vote up
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));
  }
}
 
Example 6
Source Project: hadoop   Source File: ContainerTokenIdentifier.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 7
Source Project: hadoop   Source File: ContainerTokenIdentifierForTest.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 8
Source Project: hadoop   Source File: ContainerTokenIdentifierForTest.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 9
Source Project: big-c   Source File: ContainerTokenIdentifier.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 10
Source Project: big-c   Source File: ContainerTokenIdentifierForTest.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 11
Source Project: big-c   Source File: ContainerTokenIdentifierForTest.java    License: Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 12
@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()));
}
 
Example 13
Source Project: ambari-metrics   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl) resource).getProto();
}
 
Example 14
Source Project: ambari-metrics   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourcePBImpl convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}
 
Example 15
Source Project: hadoop   Source File: ContainerTokenIdentifier.java    License: Apache License 2.0 4 votes vote down vote up
public Resource getResource() {
  if (!proto.hasResource()) {
    return null;
  }
  return new ResourcePBImpl(proto.getResource());
}
 
Example 16
private Resource convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}
 
Example 17
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl)resource).getProto();
}
 
Example 18
Source Project: hadoop   Source File: GetNewApplicationResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private Resource convertFromProtoFormat(ResourceProto resource) {
 return new ResourcePBImpl(resource);
}
 
Example 19
Source Project: hadoop   Source File: GetNewApplicationResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceProto convertToProtoFormat(Resource resource) {
 return ((ResourcePBImpl)resource).getProto();
}
 
Example 20
Source Project: hadoop   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
 
Example 21
Source Project: hadoop   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ResourceProto convertToProtoFormat(Resource r) {
  return ((ResourcePBImpl) r).getProto();
}
 
Example 22
Source Project: hadoop   Source File: NMContainerStatusPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
 
Example 23
Source Project: hadoop   Source File: NMContainerStatusPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceProto convertToProtoFormat(Resource t) {
  return ((ResourcePBImpl) t).getProto();
}
 
Example 24
Source Project: hadoop   Source File: RegisterNodeManagerRequestPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
  return new ResourcePBImpl(p);
}
 
Example 25
Source Project: hadoop   Source File: RegisterNodeManagerRequestPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceProto convertToProtoFormat(Resource t) {
  return ((ResourcePBImpl)t).getProto();
}
 
Example 26
Source Project: hadoop   Source File: ContainerTokenIdentifierForTest.java    License: Apache License 2.0 4 votes vote down vote up
public Resource getResource() {
  return new ResourcePBImpl(proto.getResource());
}
 
Example 27
Source Project: hadoop   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourceProto convertToProtoFormat(Resource resource) {
  return ((ResourcePBImpl) resource).getProto();
}
 
Example 28
Source Project: hadoop   Source File: ContainerStartDataPBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private ResourcePBImpl convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}
 
Example 29
Source Project: big-c   Source File: ContainerTokenIdentifier.java    License: Apache License 2.0 4 votes vote down vote up
public Resource getResource() {
  if (!proto.hasResource()) {
    return null;
  }
  return new ResourcePBImpl(proto.getResource());
}
 
Example 30
private Resource convertFromProtoFormat(ResourceProto resource) {
  return new ResourcePBImpl(resource);
}