incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1079664 - /incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPJobClient.java
Date Wed, 09 Mar 2011 04:51:56 GMT
Author: edwardyoon
Date: Wed Mar  9 04:51:56 2011
New Revision: 1079664

URL: http://svn.apache.org/viewvc?rev=1079664&view=rev
Log:
Re-commit for job status command.

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

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPJobClient.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPJobClient.java?rev=1079664&r1=1079663&r2=1079664&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPJobClient.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/BSPJobClient.java Wed Mar  9 04:51:56
2011
@@ -198,9 +198,9 @@ public class BSPJobClient extends Config
 
   public void init(Configuration conf) throws IOException {
     this.jobSubmitClient = (JobSubmissionProtocol) RPC.getProxy(
-        JobSubmissionProtocol.class, JobSubmissionProtocol.versionID, BSPMaster
-            .getAddress(conf), conf, NetUtils.getSocketFactory(conf,
-            JobSubmissionProtocol.class));
+        JobSubmissionProtocol.class, JobSubmissionProtocol.versionID,
+        BSPMaster.getAddress(conf), conf,
+        NetUtils.getSocketFactory(conf, JobSubmissionProtocol.class));
   }
 
   /**
@@ -337,8 +337,8 @@ public class BSPJobClient extends Config
     //
     // Now, actually submit the job (using the submit name)
     //
-    JobStatus status = jobSubmitClient.submitJob(jobId, submitJobFile
-        .toString());
+    JobStatus status = jobSubmitClient.submitJob(jobId,
+        submitJobFile.toString());
     if (status != null) {
       return new NetworkedJob(status);
     } else {
@@ -519,7 +519,7 @@ public class BSPJobClient extends Config
       }
       jobid = args[1];
       getStatus = true;
-      
+
       // TODO Later, below functions should be implemented
       // with the Fault Tolerant mechanism.
     } else if ("-list-attempt-ids".equals(cmd)) {
@@ -561,8 +561,14 @@ public class BSPJobClient extends Config
       if (job == null) {
         System.out.println("Could not find job " + jobid);
       } else {
+        JobStatus jobStatus = jobSubmitClient.getJobStatus(job.getID());
         System.out.println("Job name: " + job.getJobName());
-        System.out.println("Job status: " + getStatusString(job.getJobState()));
+        System.out.printf("States are:\n\tRunning : 1\tSucceded : 2"
+            + "\tFailed : 3\tPrep : 4\n");
+        System.out.printf("%s\t%d\t%d\t%s\n", jobStatus.getJobID(),
+            jobStatus.getRunState(), jobStatus.getStartTime(),
+            jobStatus.getUsername());
+
         exitCode = 0;
       }
     }
@@ -570,21 +576,6 @@ public class BSPJobClient extends Config
     return 0;
   }
 
-  private String getStatusString(int jobState) {
-    if(jobState == 1)
-      return "Running";
-    else if (jobState == 2)
-      return "Succeded";
-    else if (jobState == 3)
-      return "Failed";
-    else if (jobState == 4)
-      return "Prepare";
-    else if (jobState == 5)
-      return "Killed";
-    else
-      return "";
-  }
-
   /**
    * Display usage of the command-line tool and terminate execution
    */



Mime
View raw message