|
@@ -18,6 +18,8 @@
|
|
|
|
|
|
package org.apache.hadoop.yarn.server.resourcemanager.rmapp;
|
|
|
|
|
|
+import java.net.URI;
|
|
|
+import java.net.URISyntaxException;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
|
import java.util.EnumSet;
|
|
@@ -76,6 +78,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAddedSchedulerEvent;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppRemovedSchedulerEvent;
|
|
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
|
+import org.apache.hadoop.yarn.server.webproxy.ProxyUriUtils;
|
|
|
import org.apache.hadoop.yarn.state.InvalidStateTransitonException;
|
|
|
import org.apache.hadoop.yarn.state.MultipleArcTransition;
|
|
|
import org.apache.hadoop.yarn.state.SingleArcTransition;
|
|
@@ -84,6 +87,7 @@ import org.apache.hadoop.yarn.state.StateMachineFactory;
|
|
|
import org.apache.hadoop.yarn.util.Clock;
|
|
|
import org.apache.hadoop.yarn.util.SystemClock;
|
|
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
|
|
+import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
|
|
@@ -542,6 +546,7 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
float progress = 0.0f;
|
|
|
org.apache.hadoop.yarn.api.records.Token amrmToken = null;
|
|
|
if (allowAccess) {
|
|
|
+ trackingUrl = getDefaultProxyTrackingUrl();
|
|
|
if (this.currentAttempt != null) {
|
|
|
currentApplicationAttemptId = this.currentAttempt.getAppAttemptId();
|
|
|
trackingUrl = this.currentAttempt.getTrackingUrl();
|
|
@@ -602,6 +607,20 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String getDefaultProxyTrackingUrl() {
|
|
|
+ try {
|
|
|
+ final String scheme = WebAppUtils.getHttpSchemePrefix(conf);
|
|
|
+ String proxy = WebAppUtils.getProxyHostAndPort(conf);
|
|
|
+ URI proxyUri = ProxyUriUtils.getUriFromAMUrl(scheme, proxy);
|
|
|
+ URI result = ProxyUriUtils.getProxyUri(null, proxyUri, applicationId);
|
|
|
+ return result.toASCIIString();
|
|
|
+ } catch (URISyntaxException e) {
|
|
|
+ LOG.warn("Could not generate default proxy tracking URL for "
|
|
|
+ + applicationId);
|
|
|
+ return UNAVAILABLE;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public long getFinishTime() {
|
|
|
this.readLock.lock();
|