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

The following examples show how to use org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl. 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: hadoop   Source File: RMStateStoreTestBase.java    License: 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 Project: big-c   Source File: RMStateStoreTestBase.java    License: 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 Project: hadoop   Source File: ApplicationAttemptStateDataPBImpl.java    License: 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 Project: big-c   Source File: ApplicationAttemptStateDataPBImpl.java    License: 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
private ContainerPBImpl convertFromProtoFormat(ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example 6
private ContainerProto convertToProtoFormat(Container t) {
  return ((ContainerPBImpl) t).getProto();
}
 
Example 7
Source Project: hadoop   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ContainerPBImpl convertFromProtoFormat(
    ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example 8
Source Project: hadoop   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ContainerProto convertToProtoFormat(
    Container t) {
  return ((ContainerPBImpl)t).getProto();
}
 
Example 9
private ContainerPBImpl convertFromProtoFormat(ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example 10
private ContainerProto convertToProtoFormat(Container t) {
  return ((ContainerPBImpl) t).getProto();
}
 
Example 11
Source Project: big-c   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ContainerPBImpl convertFromProtoFormat(
    ContainerProto p) {
  return new ContainerPBImpl(p);
}
 
Example 12
Source Project: big-c   Source File: AllocateResponsePBImpl.java    License: Apache License 2.0 4 votes vote down vote up
private synchronized ContainerProto convertToProtoFormat(
    Container t) {
  return ((ContainerPBImpl)t).getProto();
}