Search in sources :

Example 1 with LogAggregationContextPBImpl

use of org.apache.hadoop.yarn.api.records.impl.pb.LogAggregationContextPBImpl in project hadoop by apache.

the class ContainerManagerImpl method recoverApplication.

private void recoverApplication(ContainerManagerApplicationProto p) throws IOException {
    ApplicationId appId = new ApplicationIdPBImpl(p.getId());
    Credentials creds = new Credentials();
    creds.readTokenStorageStream(new DataInputStream(p.getCredentials().newInput()));
    List<ApplicationACLMapProto> aclProtoList = p.getAclsList();
    Map<ApplicationAccessType, String> acls = new HashMap<ApplicationAccessType, String>(aclProtoList.size());
    for (ApplicationACLMapProto aclProto : aclProtoList) {
        acls.put(ProtoUtils.convertFromProtoFormat(aclProto.getAccessType()), aclProto.getAcl());
    }
    LogAggregationContext logAggregationContext = null;
    if (p.getLogAggregationContext() != null) {
        logAggregationContext = new LogAggregationContextPBImpl(p.getLogAggregationContext());
    }
    LOG.info("Recovering application " + appId);
    //TODO: Recover flow and flow run ID
    ApplicationImpl app = new ApplicationImpl(dispatcher, p.getUser(), appId, creds, context, p.getAppLogAggregationInitedTime());
    context.getApplications().put(appId, app);
    app.handle(new ApplicationInitEvent(appId, acls, logAggregationContext));
}
Also used : HashMap(java.util.HashMap) ApplicationImpl(org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationImpl) ApplicationInitEvent(org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationInitEvent) ByteString(com.google.protobuf.ByteString) DataInputStream(java.io.DataInputStream) LogAggregationContextPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.LogAggregationContextPBImpl) ApplicationIdPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl) ApplicationAccessType(org.apache.hadoop.yarn.api.records.ApplicationAccessType) ApplicationACLMapProto(org.apache.hadoop.yarn.proto.YarnProtos.ApplicationACLMapProto) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Credentials(org.apache.hadoop.security.Credentials) LogAggregationContext(org.apache.hadoop.yarn.api.records.LogAggregationContext)

Aggregations

ByteString (com.google.protobuf.ByteString)1 DataInputStream (java.io.DataInputStream)1 HashMap (java.util.HashMap)1 Credentials (org.apache.hadoop.security.Credentials)1 ApplicationAccessType (org.apache.hadoop.yarn.api.records.ApplicationAccessType)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 LogAggregationContext (org.apache.hadoop.yarn.api.records.LogAggregationContext)1 ApplicationIdPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl)1 LogAggregationContextPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.LogAggregationContextPBImpl)1 ApplicationACLMapProto (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationACLMapProto)1 ApplicationImpl (org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationImpl)1 ApplicationInitEvent (org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationInitEvent)1