org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl Java Examples

The following examples show how to use org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl. 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 File: RMStateStoreTestBase.java    From hadoop with Apache License 2.0 6 votes vote down vote up
protected ContainerId storeAttempt(RMStateStore store,
    ApplicationAttemptId attemptId,
    String containerIdStr, Token<AMRMTokenIdentifier> appToken,
    SecretKey clientTokenMasterKey, TestDispatcher dispatcher)
    throws Exception {

  RMAppAttemptMetrics mockRmAppAttemptMetrics = 
      mock(RMAppAttemptMetrics.class);
  Container container = new ContainerPBImpl();
  container.setId(ConverterUtils.toContainerId(containerIdStr));
  RMAppAttempt mockAttempt = mock(RMAppAttempt.class);
  when(mockAttempt.getAppAttemptId()).thenReturn(attemptId);
  when(mockAttempt.getMasterContainer()).thenReturn(container);
  when(mockAttempt.getAMRMToken()).thenReturn(appToken);
  when(mockAttempt.getClientTokenMasterKey())
      .thenReturn(clientTokenMasterKey);
  when(mockAttempt.getRMAppAttemptMetrics())
      .thenReturn(mockRmAppAttemptMetrics);
  when(mockRmAppAttemptMetrics.getAggregateAppResourceUsage())
      .thenReturn(new AggregateAppResourceUsage(0, 0, 0));
  dispatcher.attemptId = attemptId;
  store.storeNewApplicationAttempt(mockAttempt);
  waitNotify(dispatcher);
  return container.getId();
}
 
Example #2
Source File: RMStateStoreTestBase.java    From big-c with Apache License 2.0 6 votes vote down vote up
protected ContainerId storeAttempt(RMStateStore store,
    ApplicationAttemptId attemptId,
    String containerIdStr, Token<AMRMTokenIdentifier> appToken,
    SecretKey clientTokenMasterKey, TestDispatcher dispatcher)
    throws Exception {

  RMAppAttemptMetrics mockRmAppAttemptMetrics = 
      mock(RMAppAttemptMetrics.class);
  Container container = new ContainerPBImpl();
  container.setId(ConverterUtils.toContainerId(containerIdStr));
  RMAppAttempt mockAttempt = mock(RMAppAttempt.class);
  when(mockAttempt.getAppAttemptId()).thenReturn(attemptId);
  when(mockAttempt.getMasterContainer()).thenReturn(container);
  when(mockAttempt.getAMRMToken()).thenReturn(appToken);
  when(mockAttempt.getClientTokenMasterKey())
      .thenReturn(clientTokenMasterKey);
  when(mockAttempt.getRMAppAttemptMetrics())
      .thenReturn(mockRmAppAttemptMetrics);
  when(mockRmAppAttemptMetrics.getAggregateAppResourceUsage())
      .thenReturn(new AggregateAppResourceUsage(0, 0));
  dispatcher.attemptId = attemptId;
  store.storeNewApplicationAttempt(mockAttempt);
  waitNotify(dispatcher);
  return container.getId();
}
 
Example #3
Source File: ApplicationAttemptStateDataPBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}
 
Example #4
Source File: ApplicationAttemptStateDataPBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}
 
Example #5
Source File: RegisterApplicationMasterResponsePBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private ContainerPBImpl convertFromProtoFormat(ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example #6
Source File: RegisterApplicationMasterResponsePBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private ContainerProto convertToProtoFormat(Container t) {
  return ((ContainerPBImpl) t).getProto();
}
 
Example #7
Source File: AllocateResponsePBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private synchronized ContainerPBImpl convertFromProtoFormat(
    ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example #8
Source File: AllocateResponsePBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private synchronized ContainerProto convertToProtoFormat(
    Container t) {
  return ((ContainerPBImpl)t).getProto();
}
 
Example #9
Source File: RegisterApplicationMasterResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private ContainerPBImpl convertFromProtoFormat(ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example #10
Source File: RegisterApplicationMasterResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private ContainerProto convertToProtoFormat(Container t) {
  return ((ContainerPBImpl) t).getProto();
}
 
Example #11
Source File: AllocateResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private synchronized ContainerPBImpl convertFromProtoFormat(
    ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example #12
Source File: AllocateResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private synchronized ContainerProto convertToProtoFormat(
    Container t) {
  return ((ContainerPBImpl)t).getProto();
}