Search in sources :

Example 1 with ApplicationStateDataPBImpl

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.ApplicationStateDataPBImpl in project hadoop by apache.

the class ZKRMStateStore method loadRMAppState.

private synchronized void loadRMAppState(RMState rmState) throws Exception {
    List<String> childNodes = getChildren(rmAppRoot);
    for (String childNodeName : childNodes) {
        String childNodePath = getNodePath(rmAppRoot, childNodeName);
        byte[] childData = getData(childNodePath);
        if (childNodeName.startsWith(ApplicationId.appIdStrPrefix)) {
            // application
            if (LOG.isDebugEnabled()) {
                LOG.debug("Loading application from znode: " + childNodeName);
            }
            ApplicationId appId = ApplicationId.fromString(childNodeName);
            ApplicationStateDataPBImpl appState = new ApplicationStateDataPBImpl(ApplicationStateDataProto.parseFrom(childData));
            if (!appId.equals(appState.getApplicationSubmissionContext().getApplicationId())) {
                throw new YarnRuntimeException("The child node name is different " + "from the application id");
            }
            rmState.appState.put(appId, appState);
            loadApplicationAttemptState(appState, appId);
        } else {
            LOG.info("Unknown child node with name: " + childNodeName);
        }
    }
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) ApplicationStateDataPBImpl(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.ApplicationStateDataPBImpl) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId)

Example 2 with ApplicationStateDataPBImpl

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.ApplicationStateDataPBImpl in project hadoop by apache.

the class LeveldbRMStateStore method createApplicationState.

private ApplicationStateData createApplicationState(String appIdStr, byte[] data) throws IOException {
    ApplicationId appId = ApplicationId.fromString(appIdStr);
    ApplicationStateDataPBImpl appState = new ApplicationStateDataPBImpl(ApplicationStateDataProto.parseFrom(data));
    if (!appId.equals(appState.getApplicationSubmissionContext().getApplicationId())) {
        throw new YarnRuntimeException("The database entry for " + appId + " contains data for " + appState.getApplicationSubmissionContext().getApplicationId());
    }
    return appState;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) ApplicationStateDataPBImpl(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.ApplicationStateDataPBImpl) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId)

Aggregations

ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)2 ApplicationStateDataPBImpl (org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.ApplicationStateDataPBImpl)2