You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/09/15 20:07:32 UTC

airavata git commit: fixing issues with PBS parser

Repository: airavata
Updated Branches:
  refs/heads/master b2f86f60a -> b1fd3a06b


fixing issues with PBS parser


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

Branch: refs/heads/master
Commit: b1fd3a06be15a0143237b42c428f89ba0a268dd1
Parents: b2f86f6
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue Sep 15 14:07:25 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue Sep 15 14:07:25 2015 -0400

----------------------------------------------------------------------
 .../airavata/gfac/impl/job/PBSOutputParser.java      | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b1fd3a06/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
index 38d98f9..f187724 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
@@ -125,7 +125,14 @@ public class PBSOutputParser implements OutputParser {
 
     public String parseJobSubmission(String rawOutput) {
         log.debug(rawOutput);
-        return rawOutput;  //In PBS stdout is going to be directly the jobID
+        String jobId = rawOutput;
+        if (!rawOutput.isEmpty() && rawOutput.contains("\n")){
+            String[] split = rawOutput.split("\n");
+            if (split.length != 0){
+                jobId = split[0];
+            }
+        }
+        return jobId;  //In PBS stdout is going to be directly the jobID
     }
 
     public JobStatus parseJobStatus(String jobID, String rawOutput) {
@@ -150,7 +157,7 @@ public class PBSOutputParser implements OutputParser {
                     line = anInfo.split("=", 2);
                     if (line.length != 0) {
                         if (line[0].contains("job_state")) {
-	                        return new JobStatus(JobState.valueOf(line[1].replaceAll(" ", "")));
+	                        return new JobStatus(JobUtil.getJobState(line[1].replaceAll(" ", "")));
                         }
                     }
                 }
@@ -180,9 +187,9 @@ public class PBSOutputParser implements OutputParser {
                     }
 //                    lastStop = i + 1;
                     try {
-	                    statusMap.put(jobID, new JobStatus(JobState.valueOf(columnList.get(9))));
+	                    statusMap.put(jobID, new JobStatus(JobUtil.getJobState(columnList.get(9))));
                     }catch(IndexOutOfBoundsException e) {
-	                    statusMap.put(jobID, new JobStatus(JobState.valueOf("U")));
+	                    statusMap.put(jobID, new JobStatus(JobUtil.getJobState("U")));
                     }
                     found = true;
                     break;