airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Implemented UGE output parser to find jobStatus and JobId using regex
Date Thu, 14 May 2015 23:40:37 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 7d4da1958 -> 55a9346a6


Implemented UGE output parser to  find jobStatus and JobId using regex


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

Branch: refs/heads/master
Commit: 55a9346a6e4bdd5ed0f8b743d6db0a1b9f8ce98d
Parents: 7d4da19
Author: shamrath <shameerainfo@gmail.com>
Authored: Thu May 14 19:40:34 2015 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Thu May 14 19:40:34 2015 -0400

----------------------------------------------------------------------
 .../airavata/gsi/ssh/api/job/UGEOutputParser.java   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/55a9346a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/UGEOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/UGEOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/UGEOutputParser.java
index 645b975..238581a 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/UGEOutputParser.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/UGEOutputParser.java
@@ -28,9 +28,12 @@ import org.slf4j.LoggerFactory;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class UGEOutputParser implements OutputParser{
     private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
+    public static final String JOB_ID = "jobId";
 
     public void parseSingleJob(JobDescriptor jobDescriptor, String rawOutput) {
         log.debug(rawOutput);
@@ -130,7 +133,11 @@ public class UGEOutputParser implements OutputParser{
 	}
 
     public JobStatus parseJobStatus(String jobID, String rawOutput) {
-       // not implemented to sun grid engine
+        Pattern pattern = Pattern.compile("job_number:[\\s]+" + jobID);
+        Matcher matcher = pattern.matcher(rawOutput);
+        if (matcher.find()) {
+            return JobStatus.Q; // fixme; return correct status.
+        }
         return JobStatus.U;
     }
 
@@ -166,7 +173,12 @@ public class UGEOutputParser implements OutputParser{
 
     @Override
     public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
-        return null; // TODO: Implement the parse logic ( with regex if possible ).
+        Pattern pattern = Pattern.compile("(?<" + JOB_ID + ">\\S+)\\s+\\S+\\s+(" +
jobName + ")");
+        Matcher matcher = pattern.matcher(rawOutput);
+        if (matcher.find()) {
+            return matcher.group(JOB_ID);
+        }
+        return null;
     }
 
 


Mime
View raw message