YARN-1283. Fixed RM to give a fully-qualified proxy URL for an application so that clients don't need to do scheme-mangling. Contributed by Omkar Vinit Joshi.
svn merge --ignore-ancestry -c 1530819 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1530820 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9b5a023fc2
commit
82c4a9438d
|
@ -33,7 +33,6 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
||||||
import org.apache.hadoop.http.HttpConfig;
|
|
||||||
import org.apache.hadoop.mapreduce.JobID;
|
import org.apache.hadoop.mapreduce.JobID;
|
||||||
import org.apache.hadoop.mapreduce.JobStatus;
|
import org.apache.hadoop.mapreduce.JobStatus;
|
||||||
import org.apache.hadoop.mapreduce.MRJobConfig;
|
import org.apache.hadoop.mapreduce.MRJobConfig;
|
||||||
|
@ -424,9 +423,6 @@ public class ClientServiceDelegate {
|
||||||
String historyTrackingUrl = report.getTrackingUrl();
|
String historyTrackingUrl = report.getTrackingUrl();
|
||||||
String url = StringUtils.isNotEmpty(historyTrackingUrl)
|
String url = StringUtils.isNotEmpty(historyTrackingUrl)
|
||||||
? historyTrackingUrl : trackingUrl;
|
? historyTrackingUrl : trackingUrl;
|
||||||
if (!UNAVAILABLE.equals(url)) {
|
|
||||||
url = HttpConfig.getSchemePrefix() + url;
|
|
||||||
}
|
|
||||||
jobStatus = TypeConverter.fromYarn(report, url);
|
jobStatus = TypeConverter.fromYarn(report, url);
|
||||||
}
|
}
|
||||||
return jobStatus;
|
return jobStatus;
|
||||||
|
|
|
@ -514,7 +514,7 @@ public class TestClientServiceDelegate {
|
||||||
jobReport.setMapProgress(1.0f);
|
jobReport.setMapProgress(1.0f);
|
||||||
jobReport.setReduceProgress(1.0f);
|
jobReport.setReduceProgress(1.0f);
|
||||||
jobReport.setJobFile("TestJobFilePath");
|
jobReport.setJobFile("TestJobFilePath");
|
||||||
jobReport.setTrackingUrl("TestTrackingUrl");
|
jobReport.setTrackingUrl("http://TestTrackingUrl");
|
||||||
jobReportResponse.setJobReport(jobReport);
|
jobReportResponse.setJobReport(jobReport);
|
||||||
return jobReportResponse;
|
return jobReportResponse;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,10 @@ Release 2.2.1 - UNRELEASED
|
||||||
YARN-1253. Changes to LinuxContainerExecutor to run containers as a single
|
YARN-1253. Changes to LinuxContainerExecutor to run containers as a single
|
||||||
dedicated user in non-secure mode. (rvs via tucu)
|
dedicated user in non-secure mode. (rvs via tucu)
|
||||||
|
|
||||||
|
YARN-1283. Fixed RM to give a fully-qualified proxy URL for an application
|
||||||
|
so that clients don't need to do scheme-mangling. (Omkar Vinit Joshi via
|
||||||
|
vinodkv)
|
||||||
|
|
||||||
Release 2.2.0 - 2013-10-13
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -143,6 +143,21 @@ public class WebAppUtils {
|
||||||
return conf.get(YarnConfiguration.NM_WEBAPP_ADDRESS,
|
return conf.get(YarnConfiguration.NM_WEBAPP_ADDRESS,
|
||||||
YarnConfiguration.DEFAULT_NM_WEBAPP_ADDRESS);
|
YarnConfiguration.DEFAULT_NM_WEBAPP_ADDRESS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if url has scheme then it will be returned as it is else it will return
|
||||||
|
* url with scheme.
|
||||||
|
* @param schemePrefix eg. http:// or https://
|
||||||
|
* @param url
|
||||||
|
* @return url with scheme
|
||||||
|
*/
|
||||||
|
public static String getURLWithScheme(String schemePrefix, String url) {
|
||||||
|
// If scheme is provided then it will be returned as it is
|
||||||
|
if (url.indexOf("://") > 0) {
|
||||||
|
return url;
|
||||||
|
} else {
|
||||||
|
return schemePrefix + url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
this.readLock = lock.readLock();
|
this.readLock = lock.readLock();
|
||||||
this.writeLock = lock.writeLock();
|
this.writeLock = lock.writeLock();
|
||||||
|
|
||||||
this.proxiedTrackingUrl = generateProxyUriWithoutScheme();
|
this.proxiedTrackingUrl = generateProxyUriWithScheme(null);
|
||||||
|
|
||||||
this.stateMachine = stateMachineFactory.make(this);
|
this.stateMachine = stateMachineFactory.make(this);
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -470,11 +470,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateProxyUriWithoutScheme() {
|
private String generateProxyUriWithScheme(
|
||||||
return generateProxyUriWithoutScheme(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateProxyUriWithoutScheme(
|
|
||||||
final String trackingUriWithoutScheme) {
|
final String trackingUriWithoutScheme) {
|
||||||
this.readLock.lock();
|
this.readLock.lock();
|
||||||
try {
|
try {
|
||||||
|
@ -484,8 +480,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
|
URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
|
||||||
URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
|
URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
|
||||||
applicationAttemptId.getApplicationId());
|
applicationAttemptId.getApplicationId());
|
||||||
//We need to strip off the scheme to have it match what was there before
|
return result.toASCIIString();
|
||||||
return result.toASCIIString().substring(HttpConfig.getSchemePrefix().length());
|
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
|
LOG.warn("Could not proxify "+trackingUriWithoutScheme,e);
|
||||||
return trackingUriWithoutScheme;
|
return trackingUriWithoutScheme;
|
||||||
|
@ -1006,7 +1001,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
appAttempt.origTrackingUrl =
|
appAttempt.origTrackingUrl =
|
||||||
sanitizeTrackingUrl(registrationEvent.getTrackingurl());
|
sanitizeTrackingUrl(registrationEvent.getTrackingurl());
|
||||||
appAttempt.proxiedTrackingUrl =
|
appAttempt.proxiedTrackingUrl =
|
||||||
appAttempt.generateProxyUriWithoutScheme(appAttempt.origTrackingUrl);
|
appAttempt.generateProxyUriWithScheme(appAttempt.origTrackingUrl);
|
||||||
|
|
||||||
// Let the app know
|
// Let the app know
|
||||||
appAttempt.eventHandler.handle(new RMAppEvent(appAttempt
|
appAttempt.eventHandler.handle(new RMAppEvent(appAttempt
|
||||||
|
@ -1142,7 +1137,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
appAttempt.origTrackingUrl =
|
appAttempt.origTrackingUrl =
|
||||||
sanitizeTrackingUrl(unregisterEvent.getTrackingUrl());
|
sanitizeTrackingUrl(unregisterEvent.getTrackingUrl());
|
||||||
appAttempt.proxiedTrackingUrl =
|
appAttempt.proxiedTrackingUrl =
|
||||||
appAttempt.generateProxyUriWithoutScheme(appAttempt.origTrackingUrl);
|
appAttempt.generateProxyUriWithScheme(appAttempt.origTrackingUrl);
|
||||||
appAttempt.finalStatus = unregisterEvent.getFinalApplicationStatus();
|
appAttempt.finalStatus = unregisterEvent.getFinalApplicationStatus();
|
||||||
|
|
||||||
// Tell the app
|
// Tell the app
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
||||||
import org.apache.hadoop.yarn.util.ConverterUtils;
|
import org.apache.hadoop.yarn.util.ConverterUtils;
|
||||||
import org.apache.hadoop.yarn.util.Times;
|
import org.apache.hadoop.yarn.util.Times;
|
||||||
|
import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
|
||||||
|
|
||||||
@XmlRootElement(name = "app")
|
@XmlRootElement(name = "app")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@ -91,10 +92,13 @@ public class AppInfo {
|
||||||
this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app
|
this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app
|
||||||
.getFinishTime() == 0 ? "ApplicationMaster" : "History");
|
.getFinishTime() == 0 ? "ApplicationMaster" : "History");
|
||||||
if (!trackingUrlIsNotReady) {
|
if (!trackingUrlIsNotReady) {
|
||||||
this.trackingUrl = join(HttpConfig.getSchemePrefix(), trackingUrl);
|
this.trackingUrl =
|
||||||
|
WebAppUtils.getURLWithScheme(HttpConfig.getSchemePrefix(),
|
||||||
|
trackingUrl);
|
||||||
|
this.trackingUrlPretty = this.trackingUrl;
|
||||||
|
} else {
|
||||||
|
this.trackingUrlPretty = "UNASSIGNED";
|
||||||
}
|
}
|
||||||
this.trackingUrlPretty = trackingUrlIsNotReady ? "UNASSIGNED" : join(
|
|
||||||
HttpConfig.getSchemePrefix(), trackingUrl);
|
|
||||||
this.applicationId = app.getApplicationId();
|
this.applicationId = app.getApplicationId();
|
||||||
this.applicationType = app.getApplicationType();
|
this.applicationType = app.getApplicationType();
|
||||||
this.appIdNum = String.valueOf(app.getApplicationId().getId());
|
this.appIdNum = String.valueOf(app.getApplicationId().getId());
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.http.HttpConfig;
|
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
|
import org.apache.hadoop.security.UserGroupInformation.AuthenticationMethod;
|
||||||
|
@ -277,8 +276,7 @@ public class TestRMAppAttemptTransitions {
|
||||||
URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
|
URI proxyUri = ProxyUriUtils.getUriFromAMUrl(proxy);
|
||||||
URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
|
URI result = ProxyUriUtils.getProxyUri(trackingUri, proxyUri,
|
||||||
appAttempt.getAppAttemptId().getApplicationId());
|
appAttempt.getAppAttemptId().getApplicationId());
|
||||||
url = result.toASCIIString().substring(
|
url = result.toASCIIString();
|
||||||
HttpConfig.getSchemePrefix().length());
|
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue