hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r662813 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/JobClient.java src/java/org/apache/hadoop/mapred/JobInProgress.java
Date Tue, 03 Jun 2008 14:32:06 GMT
Author: ddas
Date: Tue Jun  3 07:32:06 2008
New Revision: 662813

URL: http://svn.apache.org/viewvc?rev=662813&view=rev
Log:
HADOOP-2132. Only RUNNING/PREP jobs can be killed. Contributed by Jothi Padmanabhan.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=662813&r1=662812&r2=662813&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Jun  3 07:32:06 2008
@@ -405,6 +405,7 @@
     Thus removes the class org.apache.hadoop.mapred.JobShell.
     (Amareshwari Sriramadasu via ddas) 
 
+    HADOOP-2132. Only RUNNING/PREP jobs can be killed. (Jothi Padmanabhan via ddas)
 
 Release 0.17.0 - 2008-05-18
 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?rev=662813&r1=662812&r2=662813&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Tue Jun  3 07:32:06
2008
@@ -182,10 +182,18 @@
      */
     synchronized void ensureFreshStatus() throws IOException {
       if (System.currentTimeMillis() - statustime > MAX_JOBPROFILE_AGE) {
-        this.status = jobSubmitClient.getJobStatus(profile.getJobID());
-        this.statustime = System.currentTimeMillis();
+        updateStatus();
       }
     }
+    
+    /** Some methods need to update status immediately. So, refresh
+     * immediately
+     * @throws IOException
+     */
+    synchronized void updateStatus() throws IOException {
+      this.status = jobSubmitClient.getJobStatus(profile.getJobID());
+      this.statustime = System.currentTimeMillis();
+    }
 
     /**
      * An identifier for the job
@@ -244,7 +252,7 @@
      * Returns immediately whether the whole job is done yet or not.
      */
     public synchronized boolean isComplete() throws IOException {
-      ensureFreshStatus();
+      updateStatus();
       return (status.getRunState() == JobStatus.SUCCEEDED ||
               status.getRunState() == JobStatus.FAILED);
     }
@@ -253,7 +261,7 @@
      * True iff job completed successfully.
      */
     public synchronized boolean isSuccessful() throws IOException {
-      ensureFreshStatus();
+      updateStatus();
       return status.getRunState() == JobStatus.SUCCEEDED;
     }
 
@@ -307,7 +315,7 @@
     @Override
     public String toString() {
       try {
-        ensureFreshStatus();
+        updateStatus();
       } catch (IOException e) {
       }
       return "Job: " + profile.getJobID() + "\n" + 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java?rev=662813&r1=662812&r2=662813&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java Tue Jun  3 07:32:06
2008
@@ -1405,7 +1405,8 @@
    * Kill the job and all its component tasks.
    */
   public synchronized void kill() {
-    if (status.getRunState() != JobStatus.FAILED) {
+    if ((status.getRunState() == JobStatus.RUNNING) ||
+         (status.getRunState() == JobStatus.PREP)) {
       LOG.info("Killing job '" + this.status.getJobID() + "'");
       this.status = new JobStatus(status.getJobID(), 1.0f, 1.0f, JobStatus.FAILED);
       this.finishTime = System.currentTimeMillis();



Mime
View raw message