hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1133832 - in /hadoop/mapreduce/branches/MR-279: ./ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ ...
Date Thu, 09 Jun 2011 12:39:42 GMT
Author: vinodkv
Date: Thu Jun  9 12:39:40 2011
New Revision: 1133832

URL: http://svn.apache.org/viewvc?rev=1133832&view=rev
Log:
Send Job diagnostics from AM to RM and redirect to history-url on job completion. Contributed by Sharad Agarwal and Vinod Kumar Vavilapalli.

Modified:
    hadoop/mapreduce/branches/MR-279/CHANGES.txt
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java
    hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Application.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto
    hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEventType.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationsManagerImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/RMResourceTrackerImpl.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Application.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java
    hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java

Modified: hadoop/mapreduce/branches/MR-279/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/CHANGES.txt?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/CHANGES.txt (original)
+++ hadoop/mapreduce/branches/MR-279/CHANGES.txt Thu Jun  9 12:39:40 2011
@@ -4,6 +4,10 @@ Trunk (unreleased changes)
 
 
     MAPREDUCE-279
+
+    Sending Job diagnostics from AM to RM and redirect to history-url on job
+    completion. (vinodkv and sharadag)
+
     Fix classpath construction for Task. (vinodkv via sharad)
 
     Remove retries in dist cache so that NM's do not shutdown (mahadev)

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java Thu Jun  9 12:39:40 2011
@@ -1080,6 +1080,7 @@ public class JobImpl implements org.apac
     @Override
     public void transition(JobImpl job, JobEvent event) {
       job.abortJob(org.apache.hadoop.mapreduce.JobStatus.State.KILLED);
+      job.addDiagnostic("Job received Kill in INITED state.");
       job.finished(JobState.KILLED);
     }
   }
@@ -1088,6 +1089,7 @@ public class JobImpl implements org.apac
       implements SingleArcTransition<JobImpl, JobEvent> {
     @Override
     public void transition(JobImpl job, JobEvent event) {
+      job.addDiagnostic("Job received Kill while in RUNNING state.");
       for (Task task : job.tasks.values()) {
         job.eventHandler.handle(
             new TaskEvent(task.getID(), TaskEventType.T_KILL));
@@ -1194,6 +1196,11 @@ public class JobImpl implements org.apac
         job.eventHandler.handle(new JobHistoryEvent(job.jobId, failedEvent));
         //TODO This event not likely required - sent via abort(). 
 
+        String diagnosticMsg = "Job failed as tasks failed. " +
+            "failedMaps:" + job.failedMapTaskCount + 
+            " failedReduces:" + job.failedReduceTaskCount;
+        LOG.info(diagnosticMsg);
+        job.addDiagnostic(diagnosticMsg);
         job.abortJob(org.apache.hadoop.mapreduce.JobStatus.State.FAILED);
         return job.finished(JobState.FAILED);
       }

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java Thu Jun  9 12:39:40 2011
@@ -26,9 +26,15 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.mapreduce.JobID;
+import org.apache.hadoop.mapreduce.TypeConverter;
+import org.apache.hadoop.mapreduce.v2.api.records.JobId;
+import org.apache.hadoop.mapreduce.v2.api.records.JobState;
 import org.apache.hadoop.mapreduce.v2.app.AMConstants;
 import org.apache.hadoop.mapreduce.v2.app.AppContext;
 import org.apache.hadoop.mapreduce.v2.app.client.ClientService;
+import org.apache.hadoop.mapreduce.v2.app.job.Job;
+import org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils;
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.SecurityInfo;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -77,10 +83,14 @@ public class RMCommunicator extends Abst
 
   private final RecordFactory recordFactory =
       RecordFactoryProvider.getRecordFactory(null);
+  
+  private final AppContext context;
+  private Job job;
 
   public RMCommunicator(ClientService clientService, AppContext context) {
     super("RMCommunicator");
     this.clientService = clientService;
+    this.context = context;
     this.eventHandler = context.getEventHandler();
     this.applicationId = context.getApplicationID();
     this.applicationMaster =
@@ -101,17 +111,30 @@ public class RMCommunicator extends Abst
     //LOG.info("Scheduler is " + scheduler);
     register();
     startAllocatorThread();
+    JobID id = TypeConverter.fromYarn(context.getApplicationID());
+    JobId jobId = TypeConverter.toYarn(id);
+    job = context.getJob(jobId);
     super.start();
   }
 
+  protected AppContext getContext() {
+    return context;
+  }
+
+  protected Job getJob() {
+    return job;
+  }
+
   protected void register() {
     //Register
     applicationMaster.setApplicationId(applicationId);
-    applicationMaster.setHost(
-        clientService.getBindAddress().getAddress().getHostAddress());
+    String host = 
+      clientService.getBindAddress().getAddress().getHostAddress();
+    applicationMaster.setHost(host);
     applicationMaster.setRpcPort(clientService.getBindAddress().getPort());
     applicationMaster.setState(ApplicationState.RUNNING);
-    applicationMaster.setHttpPort(clientService.getHttpPort());
+    applicationMaster.setTrackingUrl(
+        host + ":" + clientService.getHttpPort());
     applicationMaster.setStatus(
         recordFactory.newRecordInstance(ApplicationStatus.class));
     applicationMaster.getStatus().setApplicationId(applicationId);
@@ -134,7 +157,28 @@ public class RMCommunicator extends Abst
 
   protected void unregister() {
     try {
-      applicationMaster.setState(ApplicationState.COMPLETED);
+      ApplicationState finalState = ApplicationState.RUNNING;
+      if (job.getState() == JobState.SUCCEEDED) {
+        finalState = ApplicationState.COMPLETED;
+      } else if (job.getState() == JobState.KILLED) {
+        finalState = ApplicationState.KILLED;
+      } else if (job.getState() == JobState.FAILED
+          || job.getState() == JobState.ERROR) {
+        finalState = ApplicationState.FAILED;
+      }
+      applicationMaster.setState(finalState);
+      StringBuffer sb = new StringBuffer();
+      for (String s : job.getDiagnostics()) {
+        sb.append(s).append("\n");
+      }
+      applicationMaster.setDiagnostics(sb.toString());
+      LOG.info("Setting job diagnostics to " + sb.toString());
+      
+      String historyUrl = JobHistoryUtils.getHistoryUrl(getConfig(), 
+          context.getApplicationID());
+      LOG.info("History url is " + historyUrl);
+      applicationMaster.setTrackingUrl(historyUrl);
+
       FinishApplicationMasterRequest request =
           recordFactory.newRecordInstance(FinishApplicationMasterRequest.class);
       request.setApplicationMaster(applicationMaster);

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java Thu Jun  9 12:39:40 2011
@@ -28,22 +28,18 @@ import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
+import java.util.Map.Entry;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.mapreduce.JobID;
 import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.apache.hadoop.mapreduce.TypeConverter;
-import org.apache.hadoop.mapreduce.v2.api.records.JobId;
 import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId;
 import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
 import org.apache.hadoop.mapreduce.v2.app.AMConstants;
 import org.apache.hadoop.mapreduce.v2.app.AppContext;
 import org.apache.hadoop.mapreduce.v2.app.client.ClientService;
-import org.apache.hadoop.mapreduce.v2.app.job.Job;
 import org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent;
 import org.apache.hadoop.mapreduce.v2.app.job.event.JobEventType;
 import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptContainerAssignedEvent;
@@ -112,8 +108,6 @@ public class RMContainerAllocator extend
   private int hostLocalAssigned = 0;
   private int rackLocalAssigned = 0;
   
-  private final AppContext context;
-  private Job job;
   private boolean recalculateReduceSchedule = false;
   private int mapResourceReqt;//memory
   private int reduceResourceReqt;//memory
@@ -127,7 +121,6 @@ public class RMContainerAllocator extend
 
   public RMContainerAllocator(ClientService clientService, AppContext context) {
     super(clientService, context);
-    this.context = context;
   }
 
   @Override
@@ -144,14 +137,6 @@ public class RMContainerAllocator extend
         AMConstants.DEFAULT_REDUCE_PREEMPTION_LIMIT);
   }
 
-  @Override 
-  public void start() {
-    super.start();
-    JobID id = TypeConverter.fromYarn(context.getApplicationID());
-    JobId jobId = TypeConverter.toYarn(id);
-    job = context.getJob(jobId);
-  }
-
   @Override
   protected synchronized void heartbeat() throws Exception {
     LOG.info("Before Allocation: " + getStat());
@@ -191,7 +176,7 @@ public class RMContainerAllocator extend
           if (mapResourceReqt > getMaxContainerCapability().getMemory()) {
             LOG.info("Map capability required is more than the supported " +
             		"max container capability in the cluster. Killing the Job.");
-            eventHandler.handle(new JobEvent(job.getID(), JobEventType.JOB_KILL));
+            eventHandler.handle(new JobEvent(getJob().getID(), JobEventType.JOB_KILL));
           }
         }
         //set the rounded off memory
@@ -207,7 +192,7 @@ public class RMContainerAllocator extend
           if (reduceResourceReqt > getMaxContainerCapability().getMemory()) {
             LOG.info("Reduce capability required is more than the supported " +
                     "max container capability in the cluster. Killing the Job.");
-            eventHandler.handle(new JobEvent(job.getID(), JobEventType.JOB_KILL));
+            eventHandler.handle(new JobEvent(getJob().getID(), JobEventType.JOB_KILL));
           }
         }
         //set the rounded off memory
@@ -656,8 +641,8 @@ public class RMContainerAllocator extend
           new Comparator<TaskAttemptId>() {
         @Override
         public int compare(TaskAttemptId o1, TaskAttemptId o2) {
-          float p = job.getTask(o1.getTaskId()).getAttempt(o1).getProgress() -
-              job.getTask(o2.getTaskId()).getAttempt(o2).getProgress();
+          float p = getJob().getTask(o1.getTaskId()).getAttempt(o1).getProgress() -
+              getJob().getTask(o2.getTaskId()).getAttempt(o2).getProgress();
           return p >= 0 ? 1 : -1;
         }
       });

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java Thu Jun  9 12:39:40 2011
@@ -384,17 +384,8 @@ public class TypeConverter {
   }
 
   public static JobStatus fromYarn(Application application) {
-    String trackingUrl = "";
-    try {
-      if (application.getMasterHost() != null && 
-          !application.getMasterHost().isEmpty()) {
-        URL url = 
-          new URL("http", application.getMasterHost(),
-              application.getMasterPort(), "");
-        trackingUrl = url.toString();
-      }
-    } catch (MalformedURLException ignored) {
-    }
+    String trackingUrl = application.getTrackingUrl();
+    trackingUrl = trackingUrl == null ? "" : trackingUrl;
 
     JobStatus jobStatus = 
       new JobStatus(

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java Thu Jun  9 12:39:40 2011
@@ -20,6 +20,9 @@ package org.apache.hadoop.mapreduce.v2.j
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
 import java.util.Calendar;
 import java.util.LinkedList;
 import java.util.List;
@@ -38,7 +41,9 @@ import org.apache.hadoop.mapreduce.TypeC
 import org.apache.hadoop.mapreduce.v2.MRConstants;
 import org.apache.hadoop.mapreduce.v2.api.records.JobId;
 import org.apache.hadoop.mapreduce.v2.util.MRApps;
+import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
 
 public class JobHistoryUtils {
   
@@ -460,4 +465,26 @@ public class JobHistoryUtils {
 
     return result;
   }
+
+  public static String getHistoryUrl(Configuration conf, ApplicationId appId) 
+       throws UnknownHostException {
+  //construct the history url for job
+    String hsAddress = conf.get(JHConfig.HS_WEBAPP_BIND_ADDRESS,
+        JHConfig.DEFAULT_HS_WEBAPP_BIND_ADDRESS);
+    InetSocketAddress address = NetUtils.createSocketAddr(hsAddress);
+    StringBuffer sb = new StringBuffer();
+    if (address.getAddress().isAnyLocalAddress() || 
+        address.getAddress().isLoopbackAddress()) {
+      sb.append(InetAddress.getLocalHost().getHostAddress());
+    } else {
+      sb.append(address.getHostName());
+    }
+    sb.append(":").append(address.getPort());
+    sb.append("/yarn/job/"); // TODO This will change when the history server
+                            // understands apps.
+    // TOOD Use JobId toString once UI stops using _id_id
+    sb.append("job_").append(appId.getClusterTimestamp());
+    sb.append("_").append(appId.getId()).append("_").append(appId.getId());
+    return sb.toString();
+  }
 }

Modified: hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java (original)
+++ hadoop/mapreduce/branches/MR-279/mr-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/ClientServiceDelegate.java Thu Jun  9 12:39:40 2011
@@ -113,7 +113,7 @@ public class ClientServiceDelegate {
           continue;
         }
         serviceAddr = appMaster.getHost() + ":" + appMaster.getRpcPort();
-        serviceHttpAddr = appMaster.getHost() + ":" + appMaster.getHttpPort();
+        serviceHttpAddr = appMaster.getTrackingUrl();
         currentAppState = appMaster.getState();
         if (UserGroupInformation.isSecurityEnabled()) {
           String clientTokenEncoded = appMaster.getClientToken();

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Application.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Application.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Application.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Application.java Thu Jun  9 12:39:40 2011
@@ -1,20 +1,49 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package org.apache.hadoop.yarn.api.records;
 
 public interface Application {
-  public ApplicationId getApplicationId();
-  public void setApplicationId(ApplicationId applicationId);
-  public String getUser();
-  public void setUser(String user);
-  public String getQueue();
-  public void setQueue(String queue);
-  public String getName();
-  public void setName(String name);
-  public ApplicationStatus getStatus();
-  public void setStatus(ApplicationStatus status);
-  public ApplicationState getState();
-  public void setState(ApplicationState state);
-  public String getMasterHost();
-  public void setMasterHost(String masterHost);
-  public int getMasterPort();
-  public void setMasterPort(int masterPort);
+
+  ApplicationId getApplicationId();
+  void setApplicationId(ApplicationId applicationId);
+
+  String getUser();
+  void setUser(String user);
+
+  String getQueue();
+  void setQueue(String queue);
+
+  String getName();
+  void setName(String name);
+
+  ApplicationStatus getStatus();
+  void setStatus(ApplicationStatus status);
+
+  ApplicationState getState();
+  void setState(ApplicationState state);
+
+  Container getMasterContainer();
+  void setMasterContainer(Container masterContainer);
+
+  String getDiagnostics();
+  void setDiagnostics(String diagnostics);
+
+  String getTrackingUrl();
+  void setTrackingUrl(String url);
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java Thu Jun  9 12:39:40 2011
@@ -1,22 +1,26 @@
 package org.apache.hadoop.yarn.api.records;
 
+
+//TODO: Split separate object for register, deregister and in-RM use.
 public interface ApplicationMaster {
-  public abstract ApplicationId getApplicationId();
-  public abstract String getHost();
-  public abstract int getRpcPort();
-  public abstract int getHttpPort();
-  public abstract ApplicationStatus getStatus();
-  public abstract ApplicationState getState();
-  public abstract String getClientToken();
-  public abstract int getAMFailCount();
-  public abstract int getContainerCount();
-  public abstract void setApplicationId(ApplicationId appId);
-  public abstract void setHost(String host);
-  public abstract void setRpcPort(int rpcPort);
-  public abstract void setHttpPort(int httpPort);
-  public abstract void setStatus(ApplicationStatus status);
-  public abstract void setState(ApplicationState state);
-  public abstract void setClientToken(String clientToken);
-  public abstract void setAMFailCount(int amFailCount);
-  public abstract void setContainerCount(int containerCount);
+  ApplicationId getApplicationId();
+  String getHost();
+  int getRpcPort();
+  String getTrackingUrl();
+  ApplicationStatus getStatus();
+  ApplicationState getState();
+  String getClientToken();
+  int getAMFailCount();
+  int getContainerCount();
+  String getDiagnostics();
+  void setApplicationId(ApplicationId appId);
+  void setHost(String host);
+  void setRpcPort(int rpcPort);
+  void setTrackingUrl(String url);
+  void setStatus(ApplicationStatus status);
+  void setState(ApplicationState state);
+  void setClientToken(String clientToken);
+  void setAMFailCount(int amFailCount);
+  void setContainerCount(int containerCount);
+  void setDiagnostics(String diagnostics);
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java Thu Jun  9 12:39:40 2011
@@ -1,3 +1,21 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package org.apache.hadoop.yarn.api.records;
 
 public enum ApplicationState {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java Thu Jun  9 12:39:40 2011
@@ -1,13 +1,31 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package org.apache.hadoop.yarn.api.records;
 
 public interface ApplicationStatus {
-  public abstract int getResponseId();
-  public abstract ApplicationId getApplicationId();
-  public abstract float getProgress();
-  public abstract long getLastSeen();
+  int getResponseId();
+  ApplicationId getApplicationId();
+  float getProgress();
+  long getLastSeen();
   
-  public abstract void setResponseId(int id);
-  public abstract void setApplicationId(ApplicationId applicationID);
-  public abstract void setProgress(float progress);
-  public abstract void setLastSeen(long lastSeen);
+  void setResponseId(int id);
+  void setApplicationId(ApplicationId applicationID);
+  void setProgress(float progress);
+  void setLastSeen(long lastSeen);
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java Thu Jun  9 12:39:40 2011
@@ -26,6 +26,7 @@ public interface Container extends Compa
   Resource getResource();
   ContainerState getState();
   ContainerToken getContainerToken();
+  ContainerStatus getContainerStatus();
   
   void setId(ContainerId id);
   void setContainerManagerAddress(String containerManagerAddress);
@@ -33,5 +34,5 @@ public interface Container extends Compa
   void setResource(Resource resource);
   void setState(ContainerState state);
   void setContainerToken(ContainerToken containerToken);
-  
+  void setContainerStatus(ContainerStatus containerStatus);
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java Thu Jun  9 12:39:40 2011
@@ -1,3 +1,21 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package org.apache.hadoop.yarn.api.records;
 
 public interface ContainerStatus {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationMasterPBImpl.java Thu Jun  9 12:39:40 2011
@@ -1,6 +1,8 @@
 package org.apache.hadoop.yarn.api.records.impl.pb;
 
 
+import java.util.List;
+
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
@@ -139,15 +141,15 @@ public class ApplicationMasterPBImpl ext
     builder.setRpcPort((rpcPort));
   }
   @Override
-  public int getHttpPort() {
+  public String getTrackingUrl() {
     ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder;
-    return (p.getHttpPort());
+    return (p.getTrackingUrl());
   }
 
   @Override
-  public void setHttpPort(int httpPort) {
+  public void setTrackingUrl(String url) {
     maybeInitBuilder();
-    builder.setHttpPort((httpPort));
+    builder.setTrackingUrl(url);
   }
   @Override
   public ApplicationStatus getStatus() {
@@ -214,6 +216,21 @@ public class ApplicationMasterPBImpl ext
     builder.setContainerCount(containerCount);
   }
 
+  @Override
+  public String getDiagnostics() {
+    ApplicationMasterProtoOrBuilder p = viaProto ? proto : builder;
+    return p.getDiagnostics();
+  }
+
+  @Override
+  public void setDiagnostics(String diagnostics) {
+    maybeInitBuilder();
+    if (diagnostics == null) {
+      builder.clearDiagnostics();
+      return;
+    }
+    builder.setDiagnostics(diagnostics);
+  }
 
   private ApplicationStateProto convertToProtoFormat(ApplicationState e) {
     return ProtoUtils.convertToProtoFormat(e);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPBImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPBImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPBImpl.java Thu Jun  9 12:39:40 2011
@@ -4,12 +4,14 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationStatus;
+import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationProtoOrBuilder;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStateProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationStatusProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
 
 public class ApplicationPBImpl extends ProtoBase<ApplicationProto> 
@@ -20,6 +22,7 @@ implements Application {
 
   ApplicationId applicationId;
   ApplicationStatus status;
+  Container masterContainer = null;
 
   public ApplicationPBImpl() {
     builder = ApplicationProto.newBuilder();
@@ -37,7 +40,7 @@ implements Application {
     }
 
     ApplicationProtoOrBuilder p = viaProto ? proto : builder;
-    if (!p.hasStatus()) {
+    if (!p.hasApplicationId()) {
       return null;
     }
     this.applicationId = convertFromProtoFormat(p.getApplicationId());
@@ -45,21 +48,26 @@ implements Application {
   }
   
   @Override
-  public String getMasterHost() {
+  public Container getMasterContainer() {
+    if (this.masterContainer != null) {
+      return this.masterContainer;
+    }
+
     ApplicationProtoOrBuilder p = viaProto ? proto : builder;
-    if (!p.hasMasterHost()) {
+    if (!p.hasMasterContainer()) {
       return null;
     }
-    return (p.getMasterHost());
+    this.masterContainer = convertFromProtoFormat(p.getMasterContainer());
+    return this.masterContainer;
   }
 
   @Override
-  public int getMasterPort() {
+  public String getTrackingUrl() {
     ApplicationProtoOrBuilder p = viaProto ? proto : builder;
-    if (!p.hasMasterPort()) {
-      return -1;
+    if (!p.hasTrackingUrl()) {
+      return null;
     }
-    return p.getMasterPort();
+    return p.getTrackingUrl();
   }
 
   @Override
@@ -111,7 +119,17 @@ implements Application {
     }
     return p.getUser();
   }
-  
+
+
+  @Override
+  public String getDiagnostics() {
+    ApplicationProtoOrBuilder p = viaProto ? proto : builder;
+    if (!p.hasDiagnostics()) {
+      return null;
+    }
+    return p.getDiagnostics();
+  }
+
   @Override
   public void setApplicationId(ApplicationId applicationId) {
     maybeInitBuilder();
@@ -121,23 +139,21 @@ implements Application {
   }
 
   @Override
-  public void setMasterHost(String masterHost) {
+  public void setMasterContainer(Container container) {
     maybeInitBuilder();
-    if (masterHost == null) {
-      builder.clearMasterHost();
-      return;
-    }
-    builder.setMasterHost((masterHost));
+    if (container == null)
+      builder.clearMasterContainer();
+    this.masterContainer = container;
   }
 
   @Override
-  public void setMasterPort(int masterPort) {
+  public void setTrackingUrl(String url) {
     maybeInitBuilder();
-    if (masterPort == -1) {
-      builder.clearMasterPort();
+    if (url == null) {
+      builder.clearTrackingUrl();
       return;
     }
-    builder.setMasterPort(masterPort);
+    builder.setTrackingUrl(url);
   }
 
   @Override
@@ -189,6 +205,16 @@ implements Application {
   }
 
   @Override
+  public void setDiagnostics(String diagnostics) {
+    maybeInitBuilder();
+    if (diagnostics == null) {
+      builder.clearDiagnostics();
+      return;
+    }
+    builder.setDiagnostics(diagnostics);
+  }
+
+  @Override
   public ApplicationProto getProto() {
     mergeLocalToProto();
     proto = viaProto ? proto : builder.build();
@@ -250,4 +276,12 @@ implements Application {
     return new ApplicationIdPBImpl(applicationId);
   }
 
+  private ContainerProto convertToProtoFormat(Container t) {
+    return ((ContainerPBImpl) t).getProto();
+  }
+
+  private Container convertFromProtoFormat(ContainerProto c) {
+    return new ContainerPBImpl(c);
+  }
+
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerPBImpl.java Thu Jun  9 12:39:40 2011
@@ -1,19 +1,36 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 package org.apache.hadoop.yarn.api.records.impl.pb;
 
 
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerState;
+import org.apache.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.hadoop.yarn.api.records.ContainerToken;
 import org.apache.hadoop.yarn.api.records.ProtoBase;
 import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.ContainerTokenPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProtoOrBuilder;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProto;
 import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
 import org.apache.hadoop.yarn.util.ProtoUtils;
@@ -28,7 +45,7 @@ public class ContainerPBImpl extends Pro
   private ContainerId containerId = null;
   private Resource resource = null;
   private ContainerToken containerToken = null;
-  
+  private ContainerStatus containerStatus = null;
   
   public ContainerPBImpl() {
     builder = ContainerProto.newBuilder();
@@ -192,6 +209,27 @@ public class ContainerPBImpl extends Pro
     this.containerToken = containerToken;
   }
 
+  @Override
+  public ContainerStatus getContainerStatus() {
+    ContainerProtoOrBuilder p = viaProto ? proto : builder;
+    if (this.containerStatus != null) {
+      return this.containerStatus;
+    }
+    if (!p.hasContainerStatus()) {
+      return null;
+    }
+    this.containerStatus = convertFromProtoFormat(p.getContainerStatus());
+    return this.containerStatus;
+  }
+
+  @Override
+  public void setContainerStatus(ContainerStatus containerStatus) {
+    maybeInitBuilder();
+    if (containerStatus == null) 
+      builder.clearContainerStatus();
+    this.containerStatus = containerStatus;
+  }
+
   private ContainerStateProto convertToProtoFormat(ContainerState e) {
     return ProtoUtils.convertToProtoFormat(e);
   }
@@ -224,6 +262,14 @@ public class ContainerPBImpl extends Pro
     return ((ContainerTokenPBImpl)t).getProto();
   }
 
+  private ContainerStatusPBImpl convertFromProtoFormat(ContainerStatusProto p) {
+    return new ContainerStatusPBImpl(p);
+  }
+
+  private ContainerStatusProto convertToProtoFormat(ContainerStatus t) {
+    return ((ContainerStatusPBImpl)t).getProto();
+  }
+
   //TODO Comparator
   @Override
   public int compareTo(Container other) {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-api/src/main/proto/yarn_protos.proto Thu Jun  9 12:39:40 2011
@@ -44,6 +44,7 @@ message ContainerProto {
   optional ResourceProto resource = 4;
   optional ContainerStateProto state = 5;
   optional ContainerTokenProto container_token = 6;
+  optional ContainerStatusProto container_status = 7;
 }
 
 enum ApplicationStateProto {
@@ -72,12 +73,13 @@ message ApplicationMasterProto {
   optional ApplicationIdProto application_id = 1;
   optional string host = 2;
   optional int32 rpc_port = 3;
-  optional int32 http_port = 4;
+  optional string trackingUrl = 4;
   optional ApplicationStatusProto status = 5;
   optional ApplicationStateProto state = 6;
   optional string client_token = 7;
   optional int32 containerCount = 8;
   optional int32 amFailCount = 9;
+  optional string diagnostics = 10 [default = ""];
 }
 
 message URLProto {
@@ -113,8 +115,9 @@ message ApplicationProto {
   optional string name = 4;
   optional ApplicationStatusProto status = 5;
   optional ApplicationStateProto state = 6;
-  optional string masterHost = 7;
-  optional int32 masterPort = 8;
+  optional ContainerProto masterContainer = 7;
+  optional string trackingUrl = 8;
+  optional string diagnostics = 9 [default = "N/A"];
 }
 
 message NodeIdProto {

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java Thu Jun  9 12:39:40 2011
@@ -28,6 +28,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationStatus;
+import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 
 /**
@@ -79,6 +80,7 @@ public class MockApps {
     final String user = newUserName();
     final String name = newAppName();
     final String queue = newQueue();
+    final Container masterContainer = null;
     return new Application() {
       @Override public ApplicationId getApplicationId() { return id; }
       @Override public String getUser() { return user; }
@@ -86,22 +88,22 @@ public class MockApps {
       @Override public ApplicationStatus getStatus() { return status; }
       @Override public ApplicationState getState() { return state; }
       @Override public String getQueue() { return queue; }
-      @Override public String getMasterHost() {
-        return Math.random() > 0.8 ? null : "localhost";
+      @Override public Container getMasterContainer() {
+        return masterContainer;
       }
-      @Override public int getMasterPort() { return 58888; }
+      @Override public String getTrackingUrl() { return ""; }
       @Override
       public void setApplicationId(ApplicationId applicationId) {
         // TODO Auto-generated method stub
         
       }
       @Override
-      public void setMasterHost(String masterHost) {
+      public void setMasterContainer(Container container) {
         // TODO Auto-generated method stub
         
       }
       @Override
-      public void setMasterPort(int masterPort) {
+      public void setTrackingUrl(String url) {
         // TODO Auto-generated method stub
         
       }
@@ -130,6 +132,16 @@ public class MockApps {
         // TODO Auto-generated method stub
         
       }
+      @Override
+      public String getDiagnostics() {
+        // TODO Auto-generated method stub
+        return null;
+      }
+      @Override
+      public void setDiagnostics(String diagnostics) {
+        // TODO Auto-generated method stub
+        
+      }
     };
   }
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java Thu Jun  9 12:39:40 2011
@@ -230,7 +230,8 @@ public class ContainerManagerImpl extend
   }
   
   @Override
-  public StartContainerResponse startContainer(StartContainerRequest request) throws YarnRemoteException {
+  public StartContainerResponse startContainer(StartContainerRequest request)
+      throws YarnRemoteException {
     ContainerLaunchContext launchContext = request.getContainerLaunchContext();
 
     LOG.info(" container is " + request);
@@ -275,7 +276,8 @@ public class ContainerManagerImpl extend
 
     // TODO: Validate the request
     dispatcher.getEventHandler().handle(new ApplicationInitEvent(container));
-    StartContainerResponse response = recordFactory.newRecordInstance(StartContainerResponse.class);
+    StartContainerResponse response =
+        recordFactory.newRecordInstance(StartContainerResponse.class);
     metrics.launchedContainer();
     metrics.allocateContainer(launchContext.getResource());
     return response;
@@ -296,7 +298,7 @@ public class ContainerManagerImpl extend
     }
     dispatcher.getEventHandler().handle(
         new ContainerDiagnosticsUpdateEvent(containerID,
-            "Container killed by the application."));
+            "Container killed by the ApplicationMaster."));
     dispatcher.getEventHandler().handle(
         new ContainerEvent(containerID, ContainerEventType.KILL_CONTAINER));
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEventType.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEventType.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEventType.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEventType.java Thu Jun  9 12:39:40 2011
@@ -19,11 +19,18 @@
 package org.apache.hadoop.yarn.server.nodemanager.containermanager.application;
 
 public enum ApplicationEventType {
+
+  // Source: ContainerManager
   INIT_APPLICATION,
   FINISH_APPLICATION,
 
+  // Source: ResourceLocalizationService
   APPLICATION_INITED,
-  APPLICATION_CONTAINER_FINISHED,
   APPLICATION_RESOURCES_CLEANEDUP,
+
+  // Source: Container
+  APPLICATION_CONTAINER_FINISHED,
+
+  // Source: LogAggregationService.
   APPLICATION_FINISHED,
 }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationImpl.java Thu Jun  9 12:39:40 2011
@@ -259,7 +259,7 @@ public class ApplicationImpl implements 
       for (ContainerId containerID : app.containers.keySet()) {
         app.dispatcher.getEventHandler().handle(
             new ContainerDiagnosticsUpdateEvent(containerID,
-                "Container killed on application-finish."));
+                "Container killed on application-finish event from RM."));
         app.dispatcher.getEventHandler().handle(
             new ContainerEvent(containerID,
                 ContainerEventType.KILL_CONTAINER));

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java Thu Jun  9 12:39:40 2011
@@ -32,6 +32,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
@@ -124,7 +125,7 @@ public class ContainerImpl implements Co
     .addTransition(ContainerState.LOCALIZING,
         ContainerState.LOCALIZATION_FAILED,
         ContainerEventType.RESOURCE_FAILED,
-        new KillDuringLocalizationTransition()) // TODO update diagnostics
+        new ResourceFailedTransition())
     .addTransition(ContainerState.LOCALIZING, ContainerState.LOCALIZING,
         ContainerEventType.UPDATE_DIAGNOSTICS_MSG,
         UPDATE_DIAGNOSTICS_TRANSITION)
@@ -137,6 +138,10 @@ public class ContainerImpl implements Co
         ContainerState.DONE,
         ContainerEventType.CONTAINER_RESOURCES_CLEANEDUP,
         CONTAINER_DONE_TRANSITION)
+    .addTransition(ContainerState.LOCALIZATION_FAILED,
+        ContainerState.LOCALIZATION_FAILED,
+        ContainerEventType.UPDATE_DIAGNOSTICS_MSG,
+        UPDATE_DIAGNOSTICS_TRANSITION)
 
     // From LOCALIZED State
     .addTransition(ContainerState.LOCALIZED, ContainerState.RUNNING,
@@ -322,6 +327,7 @@ public class ContainerImpl implements Co
       c.setId(this.launchContext.getContainerId());
       c.setResource(this.launchContext.getResource());
       c.setState(getCurrentState());
+      c.setContainerStatus(cloneAndGetContainerStatus());
       return c;
     } finally {
       this.readLock.unlock();
@@ -562,6 +568,27 @@ public class ContainerImpl implements Co
   }
 
   @SuppressWarnings("unchecked") // dispatcher not typed
+  static class ResourceFailedTransition implements
+      SingleArcTransition<ContainerImpl, ContainerEvent> {
+    @Override
+    public void transition(ContainerImpl container, ContainerEvent event) {
+
+      ContainerResourceFailedEvent rsrcFailedEvent =
+          (ContainerResourceFailedEvent) event;
+      container.diagnostics.append(
+          StringUtils.stringifyException(rsrcFailedEvent.getCause())).append(
+          "\n");
+
+      // Inform the localizer to decrement reference counts and cleanup
+      // resources.
+      container.dispatcher.getEventHandler().handle(
+          new ContainerLocalizationEvent(
+            LocalizationEventType.CLEANUP_CONTAINER_RESOURCES, container));
+      container.metrics.endInitingContainer();
+    }
+  }
+  
+  @SuppressWarnings("unchecked") // dispatcher not typed
   static class KillDuringLocalizationTransition implements
       SingleArcTransition<ContainerImpl, ContainerEvent> {
     @Override

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java Thu Jun  9 12:39:40 2011
@@ -77,7 +77,12 @@ public class ContainerLogsPage extends N
         ConverterUtils.toContainerId(this.recordFactory, $(CONTAINER_ID));
       Container container = this.nmContext.getContainers().get(containerId);
 
-      if (EnumSet.of(ContainerState.NEW, ContainerState.LOCALIZING,
+      if (container == null) {
+        div.h1(
+            "Unknown container. Container is either not yet running or "
+                + "has already completed or "
+                + "doesn't belong to this node at all.")._();
+      } else if (EnumSet.of(ContainerState.NEW, ContainerState.LOCALIZING,
           ContainerState.LOCALIZING).contains(container.getContainerState())) {
         div.h1("Container is not yet running. Current state is "
                 + container.getContainerState())

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMLauncher.java Thu Jun  9 12:39:40 2011
@@ -113,7 +113,7 @@ public class AMLauncher implements Runna
     LOG.info("Setting up container " + master.getMasterContainer() 
         + " for AM " + master.getMaster());  
     ContainerLaunchContext launchContext =
-        getLaunchSpec(applicationContext, masterContainerID);
+        createAMContainerLaunchContext(applicationContext, masterContainerID);
     StartContainerRequest request = recordFactory.newRecordInstance(StartContainerRequest.class);
     request.setContainerLaunchContext(launchContext);
     containerMgrProxy.startContainer(request);
@@ -159,7 +159,7 @@ public class AMLauncher implements Runna
     });
   }
 
-  private ContainerLaunchContext getLaunchSpec(
+  private ContainerLaunchContext createAMContainerLaunchContext(
       ApplicationSubmissionContext applicationMasterContext,
       ContainerId containerID) throws IOException {
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/AMTracker.java Thu Jun  9 12:39:40 2011
@@ -189,7 +189,7 @@ public class AMTracker extends AbstractS
     }
   }
 
-  protected void expireAMs(List<ApplicationId> toExpire) {
+  private void expireAMs(List<ApplicationId> toExpire) {
     for (ApplicationId app: toExpire) {
       ApplicationMasterInfo am = null;
       synchronized (applications) {
@@ -246,15 +246,21 @@ public class AMTracker extends AbstractS
         ApplicationEventType.FAILED, masterInfo));
    }
 
-  public void finish(ApplicationId application) {
+  public void finish(ApplicationMaster remoteApplicationMaster) {
+    ApplicationId applicationId = remoteApplicationMaster.getApplicationId() ;
     ApplicationMasterInfo masterInfo = null;
     synchronized(applications) {
-      masterInfo = applications.get(application);
+      masterInfo = applications.get(applicationId);
     }
     if (masterInfo == null) {
-      LOG.info("Cant find application to finish " + application);
+      LOG.info("Cant find application to finish " + applicationId);
       return;
     }
+    masterInfo.getMaster().setTrackingUrl(
+        remoteApplicationMaster.getTrackingUrl());
+    masterInfo.getMaster().setDiagnostics(
+        remoteApplicationMaster.getDiagnostics());
+
     rmContext.getDispatcher().getSyncHandler().handle(new ASMEvent<ApplicationEventType>(
         ApplicationEventType.FINISH, masterInfo));
   }
@@ -448,7 +454,8 @@ public class AMTracker extends AbstractS
       master.setApplicationId(storedAppMaster.getApplicationId());
       master.setClientToken(storedAppMaster.getClientToken());
       master.setContainerCount(storedAppMaster.getContainerCount());
-      master.setHttpPort(storedAppMaster.getHttpPort());
+      master.setTrackingUrl(storedAppMaster.getTrackingUrl());
+      master.setDiagnostics(storedAppMaster.getDiagnostics());
       master.setHost(storedAppMaster.getHost());
       master.setRpcPort(storedAppMaster.getRpcPort());
       master.setStatus(storedAppMaster.getStatus());

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationMasterInfo.java Thu Jun  9 12:39:40 2011
@@ -483,7 +483,7 @@ public class ApplicationMasterInfo imple
     ASMEvent<ApplicationEventType> event) {
       ApplicationMaster registeredMaster = event.getAppContext().getMaster();
       masterInfo.master.setHost(registeredMaster.getHost());
-      masterInfo.master.setHttpPort(registeredMaster.getHttpPort());
+      masterInfo.master.setTrackingUrl(registeredMaster.getTrackingUrl());
       masterInfo.master.setRpcPort(registeredMaster.getRpcPort());
       masterInfo.master.setStatus(registeredMaster.getStatus());
       masterInfo.master.getStatus().setProgress(0.0f);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationsManagerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationsManagerImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationsManagerImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/ApplicationsManagerImpl.java Thu Jun  9 12:39:40 2011
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ApplicationMaster;
 import org.apache.hadoop.yarn.api.records.ApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@@ -210,7 +211,7 @@ public class ApplicationsManagerImpl ext
   @Override
   public void finishApplicationMaster(ApplicationMaster applicationMaster)
   throws IOException {
-    amTracker.finish(applicationMaster.getApplicationId());
+    amTracker.finish(applicationMaster);
   }
 
   /**
@@ -265,12 +266,13 @@ public class ApplicationsManagerImpl ext
   }
   
   private Application createApplication(ApplicationMaster am, String user,
-      String queue, String name) {
+      String queue, String name, Container masterContainer) {
     Application application = 
       recordFactory.newRecordInstance(Application.class);
     application.setApplicationId(am.getApplicationId());
-    application.setMasterHost(am.getHost());
-    application.setMasterPort(am.getHttpPort());
+    application.setMasterContainer(masterContainer);
+    application.setTrackingUrl(am.getTrackingUrl());
+    application.setDiagnostics(am.getDiagnostics());
     application.setName(name);
     application.setQueue(queue);
     application.setState(am.getState());
@@ -284,7 +286,7 @@ public class ApplicationsManagerImpl ext
     List<Application> apps = new ArrayList<Application>();
     for (AppContext am: getAllApplications()) {
       apps.add(createApplication(am.getMaster(), 
-          am.getUser(), am.getQueue(), am.getName()));
+          am.getUser(), am.getQueue(), am.getName(), am.getMasterContainer()));
     }
     return apps;
   }
@@ -292,9 +294,9 @@ public class ApplicationsManagerImpl ext
   @Override
   public Application getApplication(ApplicationId appID) {
     ApplicationMasterInfo master = amTracker.get(appID);
-    return (master == null) ? null : 
-      createApplication(master.getMaster(), 
-          master.getUser(), master.getQueue(), master.getName());
+    return (master == null) ? null : createApplication(master.getMaster(),
+        master.getUser(), master.getQueue(), master.getName(),
+        master.getMasterContainer());
   }
 
 

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/RMResourceTrackerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/RMResourceTrackerImpl.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/RMResourceTrackerImpl.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/resourcetracker/RMResourceTrackerImpl.java Thu Jun  9 12:39:40 2011
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
@@ -108,6 +109,7 @@ NodeTracker, ClusterTracker {
   private static final HeartbeatResponse reboot = recordFactory.newRecordInstance(HeartbeatResponse.class);
   private long nmExpiryInterval;
   private final NodeStore nodeStore;
+  private final RMContext rmContext;
   
   public RMResourceTrackerImpl(
       ContainerTokenSecretManager containerTokenSecretManager, 
@@ -116,6 +118,7 @@ NodeTracker, ClusterTracker {
     reboot.setReboot(true);
     this.containerTokenSecretManager = containerTokenSecretManager;
     this.nmLivelinessMonitor = new NMLivelinessMonitor();
+    this.rmContext = context;
     this.nodeStore = context.getNodeStore();
   }
 
@@ -395,7 +398,13 @@ NodeTracker, ClusterTracker {
       /* inform any listeners of node heartbeats */
       updateListener(nodeManager, remoteNodeStatus.getAllContainers());
     }
-  
+
+    // For handling diagnostic information
+    for (Entry<String, List<Container>> entry : remoteNodeStatus
+        .getAllContainers().entrySet()) {
+      
+    }
+
     // Save the response    
     nTracker.setLastHeartBeatResponse(response);
     nTracker.getNodeManager().updateHealthStatus(currentNodeHealthStatus);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Application.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Application.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Application.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/Application.java Thu Jun  9 12:39:40 2011
@@ -475,7 +475,6 @@ public class Application {
     org.apache.hadoop.yarn.api.records.Application application = recordFactory
         .newRecordInstance(org.apache.hadoop.yarn.api.records.Application.class);
     application.setApplicationId(applicationId);
-    application.setMasterHost("");
     application.setName("");
     application.setQueue(queue.getQueueName());
     application.setState(org.apache.hadoop.yarn.api.records.ApplicationState.RUNNING);

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java Thu Jun  9 12:39:40 2011
@@ -48,14 +48,14 @@ class AppsBlock extends HtmlBlock {
             th(".queue", "Queue").
             th(".state", "State").
             th(".progress", "Progress").
-            th(".master", "Master UI")._()._().
+            th(".master", "Master Tracking URL")._()._().
         tbody();
     int i = 0;
     for (Application app : list.apps) {
       String appId = Apps.toString(app.getApplicationId());
-      CharSequence master = app.getMasterHost();
-      String am = master == null ? "UNASSIGNED"
-                                 : join(master, ':', app.getMasterPort());
+      String masterTrackingURL = app.getTrackingUrl();
+      masterTrackingURL =
+          masterTrackingURL == null ? "UNASSIGNED" : masterTrackingURL;
       String percent = String.format("%.1f", app.getStatus().getProgress() * 100);
       tbody.
         tr().
@@ -73,7 +73,8 @@ class AppsBlock extends HtmlBlock {
               div(_PROGRESSBAR_VALUE).
                 $style(join("width:", percent, '%'))._()._()._().
           td().
-            a(master == null ? "#" : join("http://", am), am)._()._();
+            a(masterTrackingURL == null ? "#" : join("http://",
+                masterTrackingURL), masterTrackingURL)._()._();
       if (list.rendering != Render.HTML && ++i >= 20) break;
     }
     tbody._()._();

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java Thu Jun  9 12:39:40 2011
@@ -57,9 +57,8 @@ class AppsList implements ToJSON {
         out.append(",\n");
       }
       String appID = Apps.toString(app.getApplicationId());
-      CharSequence master = app.getMasterHost();
-      String ui = master == null ? "UNASSIGNED"
-                                 : join(master, ':', app.getMasterPort());
+      String masterTrackingURL = app.getTrackingUrl();
+      masterTrackingURL = masterTrackingURL == null ? "UNASSIGNED" : masterTrackingURL;
       out.append("[\"");
       appendSortable(out, app.getApplicationId().getId());
       appendLink(out, appID, rc.prefix(), "app", appID).append(_SEP).
@@ -68,8 +67,9 @@ class AppsList implements ToJSON {
           append(escapeHtml(app.getQueue())).append(_SEP).
           append(app.getState().toString()).append(_SEP);
       appendProgressBar(out, app.getStatus().getProgress()).append(_SEP);
-      appendLink(out, ui, rc.prefix(), master == null ? "#" : "http://", ui).
-          append("\"]");
+      appendLink(out, masterTrackingURL, rc.prefix(),
+          masterTrackingURL == null ? "#" : "http://", masterTrackingURL)
+          .append("\"]");
     }
     out.append(']');
   }

Modified: hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java?rev=1133832&r1=1133831&r2=1133832&view=diff
==============================================================================
--- hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java (original)
+++ hadoop/mapreduce/branches/MR-279/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java Thu Jun  9 12:39:40 2011
@@ -18,23 +18,24 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
-import com.google.inject.Inject;
+import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.APP_ID;
+import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.QUEUE_NAME;
+import static org.apache.hadoop.yarn.util.StringHelper.join;
 
 import org.apache.hadoop.util.VersionInfo;
 import org.apache.hadoop.yarn.api.records.Application;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.ApplicationsManager;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
 import org.apache.hadoop.yarn.util.Apps;
+import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.hadoop.yarn.util.Times;
 import org.apache.hadoop.yarn.webapp.Controller;
 import org.apache.hadoop.yarn.webapp.ResponseInfo;
 
-import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.*;
-import static org.apache.hadoop.yarn.util.StringHelper.*;
+import com.google.inject.Inject;
 
 // Do NOT rename/refactor this to RMView as it will wreak havoc
 // on Mac OS HFS as its case-insensitive!
@@ -75,9 +76,8 @@ public class RmController extends Contro
       return;
     }
     setTitle(join("Application ", aid));
-    CharSequence master = app.getMasterHost();
-    String ui = master == null ? "UNASSIGNED"
-                               : join(master, ':', app.getMasterPort());
+    CharSequence masterTrackingURL = app.getTrackingUrl();
+    String ui = masterTrackingURL == null ? "UNASSIGNED" : app.getTrackingUrl();
 
     ResponseInfo info = info("Application Overview").
       _("User:", app.getUser()).
@@ -85,11 +85,17 @@ public class RmController extends Contro
       _("State:", app.getState()).
       _("Started:", "FIXAPI!").
       _("Elapsed:", "FIXAPI!").
-      _("Master UI:", master == null ? "#" : join("http://", ui), ui);
-    if (app.getState() == ApplicationState.COMPLETED || 
-        app.getState() == ApplicationState.FAILED || 
-        app.getState() == ApplicationState.KILLED) {
-      info._("History:", "FIXAPI!");
+            _("Master Tracking URL:",
+                masterTrackingURL == null ? "#" : join("http://", ui), ui).
+      _("Diagnostics:", app.getDiagnostics());
+    if (app.getMasterContainer() != null) {
+      info._(
+          "AM container logs:",
+          join("http://", app.getMasterContainer().getNodeHttpAddress(),
+              "yarn", "containerlogs",
+              ConverterUtils.toString(app.getMasterContainer().getId())));
+    } else {
+      info._("AM container logs:", "AM not yet registered with RM");
     }
     render(InfoPage.class);
   }



Mime
View raw message