airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: modifying logs to get a better view of monitoring
Date Thu, 18 Sep 2014 21:59:13 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 5305b303d -> 716b85fd4


modifying logs to get a better view of monitoring


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/716b85fd
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/716b85fd
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/716b85fd

Branch: refs/heads/master
Commit: 716b85fd44dcd2cab77805a0f87f79888627e8e3
Parents: 5305b30
Author: lahiru <lahiru@apache.org>
Authored: Thu Sep 18 17:59:09 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Thu Sep 18 17:59:09 2014 -0400

----------------------------------------------------------------------
 .../gsi/ssh/api/job/PBSOutputParser.java        |  4 +++
 .../gsi/ssh/api/job/SlurmOutputParser.java      | 34 +++++++++++---------
 2 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/716b85fd/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/PBSOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/PBSOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/PBSOutputParser.java
index 6ea5846..6787555 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/PBSOutputParser.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/PBSOutputParser.java
@@ -162,6 +162,7 @@ public class PBSOutputParser implements OutputParser {
 //        int lastStop = 0;
         for (String jobID : statusMap.keySet()) {
             String jobName = jobID.split(",")[1];
+            boolean found = false;
             for (int i = 0; i < info.length; i++) {
                 if (info[i].contains(jobName.substring(0,8))) {
                     // now starts processing this line
@@ -176,8 +177,11 @@ public class PBSOutputParser implements OutputParser {
                     }
 //                    lastStop = i + 1;
                     statusMap.put(jobID, JobStatus.valueOf(columnList.get(9)));
+                    found = true;
                     break;
                 }
+            }
+            if(!found) {
                 log.error("Couldn't find the status of the Job with JobName: " + jobName
+ "Job Id: " + jobID.split(",")[0]);
             }
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/716b85fd/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SlurmOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SlurmOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SlurmOutputParser.java
index 64d8417..c12441b 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SlurmOutputParser.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SlurmOutputParser.java
@@ -33,21 +33,21 @@ import java.util.Map;
 public class SlurmOutputParser implements OutputParser {
     private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
 
-    public void parse(JobDescriptor descriptor, String rawOutput)throws SSHApiException {
+    public void parse(JobDescriptor descriptor, String rawOutput) throws SSHApiException
{
         log.info(rawOutput);
         String[] info = rawOutput.split("\n");
-        String lastString = info[info.length -1];
+        String lastString = info[info.length - 1];
         if (lastString.contains("JOB ID")) {
             // because there's no state
             descriptor.setStatus("U");
-        }else{
+        } else {
             int column = 0;
             System.out.println(lastString);
-            for(String each:lastString.split(" ")){
-                if(each.trim().isEmpty()){
+            for (String each : lastString.split(" ")) {
+                if (each.trim().isEmpty()) {
                     continue;
-                }else{
-                    switch (column){
+                } else {
+                    switch (column) {
                         case 0:
                             descriptor.setJobID(each);
                             column++;
@@ -106,18 +106,18 @@ public class SlurmOutputParser implements OutputParser {
 //        throw new SSHApiException(rawOutput);  //todo//To change body of implemented methods
use File | Settings | File Templates.
     }
 
-    public JobStatus parse(String jobID, String rawOutput)throws SSHApiException {
+    public JobStatus parse(String jobID, String rawOutput) throws SSHApiException {
         log.info(rawOutput);
         String[] info = rawOutput.split("\n");
-        String lastString = info[info.length -1];
+        String lastString = info[info.length - 1];
         if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
             // because there's no state
             return JobStatus.valueOf("U");
-        }else{
+        } else {
             int column = 0;
-            for(String each:lastString.split(" ")){
-                if(!each.trim().isEmpty()){
-                    switch (column){
+            for (String each : lastString.split(" ")) {
+                if (!each.trim().isEmpty()) {
+                    switch (column) {
                         case 0:
                             column++;
                             break;
@@ -151,7 +151,7 @@ public class SlurmOutputParser implements OutputParser {
     public void parse(String userName, Map<String, JobStatus> statusMap, String rawOutput)
throws SSHApiException {
         log.debug(rawOutput);
         String[] info = rawOutput.split("\n");
-        String lastString = info[info.length -1];
+        String lastString = info[info.length - 1];
         if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
             log.info("There are no jobs with this username ... ");
             return;
@@ -160,8 +160,9 @@ public class SlurmOutputParser implements OutputParser {
         for (String jobID : statusMap.keySet()) {
             String jobId = jobID.split(",")[0];
             String jobName = jobID.split(",")[1];
+            boolean found = false;
             for (int i = 0; i < info.length; i++) {
-                if (info[i].contains(jobName.substring(0,8))) {
+                if (info[i].contains(jobName.substring(0, 8))) {
                     // now starts processing this line
                     log.info(info[i]);
                     String correctLine = info[i];
@@ -174,8 +175,11 @@ public class SlurmOutputParser implements OutputParser {
                     }
 //                    lastStop = i + 1;
                     statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
+                    found = true;
                     break;
                 }
+            }
+            if (!found) {
                 log.error("Couldn't find the status of the Job with JobName: " + jobName
+ "Job Id: " + jobId);
             }
         }


Mime
View raw message