Search in sources :

Example 56 with YarnRuntimeException

use of org.apache.hadoop.yarn.exceptions.YarnRuntimeException 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 57 with YarnRuntimeException

use of org.apache.hadoop.yarn.exceptions.YarnRuntimeException in project hadoop by apache.

the class RMAppAttemptImpl method getAMRMTokenKeyId.

@Private
public int getAMRMTokenKeyId() {
    Integer keyId = this.amrmTokenKeyId;
    if (keyId == null) {
        this.readLock.lock();
        try {
            if (this.amrmToken == null) {
                throw new YarnRuntimeException("Missing AMRM token for " + this.applicationAttemptId);
            }
            keyId = this.amrmToken.decodeIdentifier().getKeyId();
            this.amrmTokenKeyId = keyId;
        } catch (IOException e) {
            throw new YarnRuntimeException("AMRM token decode error for " + this.applicationAttemptId, e);
        } finally {
            this.readLock.unlock();
        }
    }
    return keyId;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) IOException(java.io.IOException) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 58 with YarnRuntimeException

use of org.apache.hadoop.yarn.exceptions.YarnRuntimeException in project hadoop by apache.

the class RMAppAttemptImpl method getDiagnosticsLimitKCOrThrow.

private int getDiagnosticsLimitKCOrThrow(final Configuration configuration) {
    try {
        final int diagnosticsLimitKC = configuration.getInt(YarnConfiguration.APP_ATTEMPT_DIAGNOSTICS_LIMIT_KC, YarnConfiguration.DEFAULT_APP_ATTEMPT_DIAGNOSTICS_LIMIT_KC);
        if (diagnosticsLimitKC <= 0) {
            final String message = String.format(DIAGNOSTIC_LIMIT_CONFIG_ERROR_MESSAGE, YarnConfiguration.APP_ATTEMPT_DIAGNOSTICS_LIMIT_KC, diagnosticsLimitKC);
            LOG.error(message);
            throw new YarnRuntimeException(message);
        }
        return diagnosticsLimitKC;
    } catch (final NumberFormatException ignored) {
        final String diagnosticsLimitKCString = configuration.get(YarnConfiguration.APP_ATTEMPT_DIAGNOSTICS_LIMIT_KC);
        final String message = String.format(DIAGNOSTIC_LIMIT_CONFIG_ERROR_MESSAGE, YarnConfiguration.APP_ATTEMPT_DIAGNOSTICS_LIMIT_KC, diagnosticsLimitKCString);
        LOG.error(message);
        throw new YarnRuntimeException(message);
    }
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException)

Example 59 with YarnRuntimeException

use of org.apache.hadoop.yarn.exceptions.YarnRuntimeException in project hadoop by apache.

the class TestResourceManager method testNMExpiryAndHeartbeatIntervalsValidation.

@Test
public void testNMExpiryAndHeartbeatIntervalsValidation() throws Exception {
    Configuration conf = new YarnConfiguration();
    conf.setLong(YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS, 1000);
    conf.setLong(YarnConfiguration.RM_NM_HEARTBEAT_INTERVAL_MS, 1001);
    try {
        resourceManager = new MockRM(conf);
    } catch (YarnRuntimeException e) {
        // Exception is expected.
        if (!e.getMessage().startsWith("Nodemanager expiry interval should be no" + " less than heartbeat interval")) {
            throw e;
        }
    }
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Test(org.junit.Test)

Example 60 with YarnRuntimeException

use of org.apache.hadoop.yarn.exceptions.YarnRuntimeException in project hadoop by apache.

the class TestResourceManager method testResourceManagerInitConfigValidation.

@Test(timeout = 30000)
public void testResourceManagerInitConfigValidation() throws Exception {
    Configuration conf = new YarnConfiguration();
    conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, -1);
    try {
        resourceManager = new MockRM(conf);
        fail("Exception is expected because the global max attempts" + " is negative.");
    } catch (YarnRuntimeException e) {
        // Exception is expected.
        if (!e.getMessage().startsWith("Invalid global max attempts configuration"))
            throw e;
    }
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Test(org.junit.Test)

Aggregations

YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)147 IOException (java.io.IOException)56 Configuration (org.apache.hadoop.conf.Configuration)38 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)28 Test (org.junit.Test)28 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)17 InetSocketAddress (java.net.InetSocketAddress)12 Path (org.apache.hadoop.fs.Path)12 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 Server (org.apache.hadoop.ipc.Server)8 FileSystem (org.apache.hadoop.fs.FileSystem)7 FsPermission (org.apache.hadoop.fs.permission.FsPermission)7 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)7 FileNotFoundException (java.io.FileNotFoundException)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)6 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)6 ConnectException (java.net.ConnectException)5