MAPREDUCE-3163. JobClient spews errors when killing MR2 job. (mahadev) - Merging r1187491 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1187492 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mahadev Konar 2011-10-21 18:38:26 +00:00
parent 5acc010db8
commit 1edb5c8f9e
3 changed files with 15 additions and 12 deletions

View File

@ -363,6 +363,9 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3144. Augmented JobHistory with the information needed for
serving aggregated logs. (Siddharth Seth via vinodkv)
MAPREDUCE-3163. JobClient spews errors when killing MR2 job.
(mahadev)
OPTIMIZATIONS

View File

@ -56,21 +56,18 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobReport;
import org.apache.hadoop.mapreduce.v2.api.records.JobState;
import org.apache.hadoop.mapreduce.v2.util.MRApps;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.SecurityInfo;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.yarn.YarnException;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
import org.apache.hadoop.yarn.ipc.RPCUtil;
import org.apache.hadoop.yarn.ipc.YarnRPC;
import org.apache.hadoop.yarn.security.ApplicationTokenIdentifier;
import org.apache.hadoop.yarn.security.SchedulerSecurityInfo;
public class ClientServiceDelegate {
private static final Log LOG = LogFactory.getLog(ClientServiceDelegate.class);
@ -128,7 +125,7 @@ public class ClientServiceDelegate {
if (!forceRefresh && realProxy != null) {
return realProxy;
}
//TODO RM NPEs for unknown jobs. History may still be aware.
// Possibly allow nulls through the PB tunnel, otherwise deal with an exception
// and redirect to the history server.
ApplicationReport application = rm.getApplicationReport(appId);
@ -136,7 +133,7 @@ public class ClientServiceDelegate {
trackingUrl = application.getTrackingUrl();
}
String serviceAddr = null;
while (application == null || YarnApplicationState.RUNNING.equals(application.getYarnApplicationState())) {
while (application == null || YarnApplicationState.RUNNING == application.getYarnApplicationState()) {
if (application == null) {
LOG.info("Could not get Job info from RM for job " + jobId
+ ". Redirecting to job history server.");
@ -196,7 +193,6 @@ public class ClientServiceDelegate {
* block on it. This is to be able to return job status
* on an allocating Application.
*/
String user = application.getUser();
if (user == null) {
throw RPCUtil.getRemoteException("User is not set in the application report");
@ -269,16 +265,19 @@ public class ClientServiceDelegate {
throw yre;
} catch (InvocationTargetException e) {
if (e.getTargetException() instanceof YarnRemoteException) {
LOG.warn("Exception thrown by remote end.", e
.getTargetException());
LOG.warn("Error from remote end: " + e
.getTargetException().getLocalizedMessage());
LOG.debug("Tracing remote error ", e.getTargetException());
throw (YarnRemoteException) e.getTargetException();
}
LOG.info("Failed to contact AM/History for job " + jobId
+ " Will retry..", e.getTargetException());
LOG.info("Failed to contact AM/History for job " + jobId +
" retrying..");
LOG.debug("Failed exception on AM/History contact",
e.getTargetException());
forceRefresh = true;
} catch (Exception e) {
LOG.info("Failed to contact AM/History for job " + jobId
+ " Will retry..", e);
+ " Will retry..");
LOG.debug("Failing to contact application master", e);
forceRefresh = true;
}

View File

@ -212,7 +212,8 @@ public class RMAppImpl implements RMApp {
&& currentAttempt.getFinalApplicationStatus() != null) {
return currentAttempt.getFinalApplicationStatus();
}
return createFinalApplicationStatus(this.stateMachine.getCurrentState());
return
createFinalApplicationStatus(this.stateMachine.getCurrentState());
} finally {
this.readLock.unlock();
}