You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2012/10/29 04:33:35 UTC

svn commit: r1403152 - /hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java

Author: edwardyoon
Date: Mon Oct 29 03:33:35 2012
New Revision: 1403152

URL: http://svn.apache.org/viewvc?rev=1403152&view=rev
Log:
To avoid creation of unnecessary job files on dfs, move exceeded exception to the top.

Modified:
    hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java

Modified: hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java
URL: http://svn.apache.org/viewvc/hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java?rev=1403152&r1=1403151&r2=1403152&view=diff
==============================================================================
--- hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java (original)
+++ hama/trunk/core/src/main/java/org/apache/hama/bsp/BSPJobClient.java Mon Oct 29 03:33:35 2012
@@ -301,6 +301,13 @@ public class BSPJobClient extends Config
     BSPJob job = pJob;
     job.setJobID(jobId);
 
+    ClusterStatus clusterStatus = getClusterStatus(true);
+    int maxTasks = clusterStatus.getMaxTasks() - clusterStatus.getTasks();
+    
+    if (maxTasks < job.getNumBspTask()) {
+      throw new IOException("Job failed! No more taks slots available");
+    }
+    
     Path submitJobDir = new Path(getSystemDir(), "submit_"
         + Integer.toString(Math.abs(r.nextInt()), 36));
     Path submitSplitFile = new Path(submitJobDir, "job.split");
@@ -318,13 +325,6 @@ public class BSPJobClient extends Config
     fs.mkdirs(submitJobDir);
     short replication = (short) job.getInt("bsp.submit.replication", 10);
 
-    ClusterStatus clusterStatus = getClusterStatus(true);
-    int maxTasks = clusterStatus.getMaxTasks() - clusterStatus.getTasks();
-    if (maxTasks < job.getNumBspTask()) {
-      LOG.error("Job failed! No more taks slots available");
-      System.exit(-1);
-    }
-
     // only create the splits if we have an input
     if (job.get("bsp.input.dir") != null) {
       // Create the splits for the job