YARN-4103. RM WebServices missing scheme for appattempts logLinks. Contributed by Jonathan Eagles.

This commit is contained in:
Varun Vasudev 2015-09-03 23:58:26 +05:30
parent c83d13c649
commit 40d222e862
5 changed files with 15 additions and 10 deletions

View File

@ -877,6 +877,9 @@ Release 2.7.2 - UNRELEASED
YARN-4101. RM should print alert messages if Zookeeper and Resourcemanager YARN-4101. RM should print alert messages if Zookeeper and Resourcemanager
gets connection issue. (Xuan Gong via jianhe) gets connection issue. (Xuan Gong via jianhe)
YARN-4103. RM WebServices missing scheme for appattempts logLinks.
(Jonathan Eagles via vvasudeb)
Release 2.7.1 - 2015-07-06 Release 2.7.1 - 2015-07-06
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -130,7 +130,8 @@ public class RMAppBlock extends AppBlock{
continue; continue;
} }
AppAttemptInfo attemptInfo = AppAttemptInfo attemptInfo =
new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.getUser()); new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.getUser(),
WebAppUtils.getHttpSchemePrefix(conf));
String blacklistedNodesCount = "N/A"; String blacklistedNodesCount = "N/A";
Set<String> nodes = Set<String> nodes =
RMAppAttemptBlock.getBlacklistedNodes(rm, RMAppAttemptBlock.getBlacklistedNodes(rm,

View File

@ -696,7 +696,8 @@ public class RMWebServices {
@GET @GET
@Path("/apps/{appid}/appattempts") @Path("/apps/{appid}/appattempts")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public AppAttemptsInfo getAppAttempts(@PathParam("appid") String appId) { public AppAttemptsInfo getAppAttempts(@Context HttpServletRequest hsr,
@PathParam("appid") String appId) {
init(); init();
if (appId == null || appId.isEmpty()) { if (appId == null || appId.isEmpty()) {
@ -714,8 +715,8 @@ public class RMWebServices {
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo(); AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
for (RMAppAttempt attempt : app.getAppAttempts().values()) { for (RMAppAttempt attempt : app.getAppAttempts().values()) {
AppAttemptInfo attemptInfo = AppAttemptInfo attemptInfo = new AppAttemptInfo(rm, attempt,
new AppAttemptInfo(rm, attempt, app.getUser()); app.getUser(), hsr.getScheme() + "://");
appAttemptsInfo.add(attemptInfo); appAttemptsInfo.add(attemptInfo);
} }

View File

@ -27,7 +27,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
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.server.resourcemanager.scheduler.AbstractYarnScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.RMAppAttemptBlock;
import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.hadoop.yarn.webapp.util.WebAppUtils; import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
@ -46,7 +45,8 @@ public class AppAttemptInfo {
public AppAttemptInfo() { public AppAttemptInfo() {
} }
public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user) { public AppAttemptInfo(ResourceManager rm, RMAppAttempt attempt, String user,
String schemePrefix) {
this.startTime = 0; this.startTime = 0;
this.containerId = ""; this.containerId = "";
this.nodeHttpAddress = ""; this.nodeHttpAddress = "";
@ -61,9 +61,9 @@ public class AppAttemptInfo {
this.containerId = masterContainer.getId().toString(); this.containerId = masterContainer.getId().toString();
this.nodeHttpAddress = masterContainer.getNodeHttpAddress(); this.nodeHttpAddress = masterContainer.getNodeHttpAddress();
this.nodeId = masterContainer.getNodeId().toString(); this.nodeId = masterContainer.getNodeId().toString();
this.logsLink = this.logsLink = WebAppUtils.getRunningLogURL(schemePrefix
WebAppUtils.getRunningLogURL("//" + masterContainer.getNodeHttpAddress(), + masterContainer.getNodeHttpAddress(),
ConverterUtils.toString(masterContainer.getId()), user); ConverterUtils.toString(masterContainer.getId()), user);
if (rm.getResourceScheduler() instanceof AbstractYarnScheduler) { if (rm.getResourceScheduler() instanceof AbstractYarnScheduler) {
AbstractYarnScheduler ayScheduler = AbstractYarnScheduler ayScheduler =
(AbstractYarnScheduler) rm.getResourceScheduler(); (AbstractYarnScheduler) rm.getResourceScheduler();

View File

@ -1635,7 +1635,7 @@ public class TestRMWebServicesApps extends JerseyTestBase {
.getMasterContainer().getNodeHttpAddress(), nodeHttpAddress); .getMasterContainer().getNodeHttpAddress(), nodeHttpAddress);
WebServicesTestUtils.checkStringMatch("nodeId", appAttempt WebServicesTestUtils.checkStringMatch("nodeId", appAttempt
.getMasterContainer().getNodeId().toString(), nodeId); .getMasterContainer().getNodeId().toString(), nodeId);
assertTrue("logsLink doesn't match", logsLink.startsWith("//")); assertTrue("logsLink doesn't match ", logsLink.startsWith("http://"));
assertTrue( assertTrue(
"logsLink doesn't contain user info", logsLink.endsWith("/" "logsLink doesn't contain user info", logsLink.endsWith("/"
+ user)); + user));