airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/3] fixing monitoring to monitor with job name too
Date Thu, 24 Jul 2014 18:44:55 GMT
Repository: airavata
Updated Branches:
  refs/heads/master f5693907c -> 03ecceab1


http://git-wip-us.apache.org/repos/asf/airavata/blob/5a22a355/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt b/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
index e749e9c..cf8dfb6 100644
--- a/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
+++ b/modules/gfac/gfac-ssh/src/test/resources/PBSTemplate.xslt
@@ -5,11 +5,11 @@
 	in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF
 	ANY ~ KIND, either express or implied. See the License for the specific language governing
permissions and limitations under
 	the License. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
 <xsl:output method="text" />
 <xsl:template match="/ns:JobDescriptor">
 #! /bin/sh
-# PBS batch job script built by Globus job manager
+# PBS batch job submission script generated by Apache Airavata
 #   <xsl:choose>
     <xsl:when test="ns:shellName">
 ##PBS -S <xsl:value-of select="ns:shellName"/>
@@ -59,8 +59,10 @@ export<xsl:text>   </xsl:text><xsl:value-of select="."/>
       <xsl:value-of select="."/><xsl:text>   </xsl:text>
     </xsl:for-each>
 cd <xsl:text>   </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>&#xa;</xsl:text>
-    <xsl:choose><xsl:when test="ns:jobSubmitterCommand">
-<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text>   </xsl:text></xsl:when></xsl:choose><xsl:value-of
select="ns:executablePath"/><xsl:text>   </xsl:text>
+    <xsl:choose><xsl:when test="ns:jobSubmitterCommand != ''">
+<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text>   </xsl:text>
+<xsl:value-of select="ns:cpuCount"/><xsl:text>   </xsl:text>
+    </xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text>
  </xsl:text>
 <xsl:for-each select="ns:inputs/ns:input">
       <xsl:value-of select="."/><xsl:text>   </xsl:text>
     </xsl:for-each>

http://git-wip-us.apache.org/repos/asf/airavata/blob/5a22a355/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 f7516c7..23c0122 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
@@ -158,25 +158,25 @@ public class PBSOutputParser implements OutputParser {
 
     public void parse(String userName, Map<String, JobStatus> statusMap, String rawOutput)
{
         log.debug(rawOutput);
-        String[] info = rawOutput.split("\n");
+        String[]    info = rawOutput.split("\n");
         int lastStop = 0;
         for (String jobID : statusMap.keySet()) {
-            for(int i=lastStop;i<info.length;i++){
-               if(jobID.contains(info[i].split(" ")[0]) && !"".equals(info[i].split("
")[0])){
-                   // now starts processing this line
-                   log.info(info[i]);
-                   String correctLine = info[i];
-                   String[] columns = correctLine.split(" ");
-                   List<String> columnList = new ArrayList<String>();
-                   for (String s : columns) {
-                       if (!"".equals(s)) {
-                           columnList.add(s);
-                       }
-                   }
-                   lastStop = i+1;
-                   statusMap.put(jobID, JobStatus.valueOf(columnList.get(9)));
-                   break;
-               }
+            for (int i = lastStop; i < info.length; i++) {
+                if (jobID.split(",")[0].contains(info[i].split(" ")[0]) && !"".equals(info[i].split("
")[0])) {
+                    // now starts processing this line
+                    log.info(info[i]);
+                    String correctLine = info[i];
+                    String[] columns = correctLine.split(" ");
+                    List<String> columnList = new ArrayList<String>();
+                    for (String s : columns) {
+                        if (!"".equals(s)) {
+                            columnList.add(s);
+                        }
+                    }
+                    lastStop = i + 1;
+                    statusMap.put(jobID, JobStatus.valueOf(columnList.get(9)));
+                    break;
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/5a22a355/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
index b2c0cff..ab60bb3 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/SGEOutputParser.java
@@ -135,7 +135,7 @@ public class SGEOutputParser implements OutputParser{
         int lastStop = 0;
         for (String jobID : statusMap.keySet()) {
             for(int i=lastStop;i<info.length;i++){
-               if(jobID.contains(info[i].split(" ")[0]) && !"".equals(info[i].split("
")[0])){
+               if(jobID.split(",")[0].contains(info[i].split(" ")[0]) && !"".equals(info[i].split("
")[0])){
                    // now starts processing this line
                    log.info(info[i]);
                    String correctLine = info[i];

http://git-wip-us.apache.org/repos/asf/airavata/blob/5a22a355/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 5738dd9..717caae 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
@@ -34,7 +34,7 @@ public class SlurmOutputParser implements OutputParser {
     private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
 
     public void parse(JobDescriptor descriptor, String rawOutput)throws SSHApiException {
-        log.debug(rawOutput);
+        log.info(rawOutput);
         String[] info = rawOutput.split("\n");
         String lastString = info[info.length -1];
         if (lastString.contains("JOB ID")) {
@@ -94,7 +94,7 @@ public class SlurmOutputParser implements OutputParser {
      * @return
      */
     public String parse(String rawOutput) throws SSHApiException {
-        log.debug(rawOutput);
+        log.info(rawOutput);
         String[] info = rawOutput.split("\n");
         for (String anInfo : info) {
             if (anInfo.contains("Submitted batch job")) {
@@ -102,11 +102,12 @@ public class SlurmOutputParser implements OutputParser {
                 return split[1].trim();
             }
         }
-        throw new SSHApiException(rawOutput);  //To change body of implemented methods use
File | Settings | File Templates.
+        return "";
+//        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 {
-        log.debug(rawOutput);
+        log.info(rawOutput);
         String[] info = rawOutput.split("\n");
         String lastString = info[info.length -1];
         if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
@@ -148,7 +149,7 @@ public class SlurmOutputParser implements OutputParser {
     }
 
     public void parse(String userName, Map<String, JobStatus> statusMap, String rawOutput)
throws SSHApiException {
-        log.debug(rawOutput);
+        log.info(rawOutput);
         String[] info = rawOutput.split("\n");
         String lastString = info[info.length -1];
         if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
@@ -157,22 +158,24 @@ public class SlurmOutputParser implements OutputParser {
         }
         int lastStop = 0;
         for (String jobID : statusMap.keySet()) {
-            for(int i=lastStop;i<info.length;i++){
-               if(info[i].contains(jobID)){
-                   // now starts processing this line
-                   log.info(info[i]);
-                   String correctLine = info[i];
-                   String[] columns = correctLine.split(" ");
-                   List<String> columnList = new ArrayList<String>();
-                   for (String s : columns) {
-                       if (!"".equals(s)) {
-                           columnList.add(s);
-                       }
-                   }
-                   lastStop = i+1;
-                   statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
-                   break;
-               }
+            String jobId = jobID.split(",")[0];
+            String jobName = jobID.split(",")[1];
+            for (int i = lastStop; i < info.length; i++) {
+                if (info[i].contains(jobId) || info[i].contains(jobName.substring(0,8)))
{
+                    // now starts processing this line
+                    log.info(info[i]);
+                    String correctLine = info[i];
+                    String[] columns = correctLine.split(" ");
+                    List<String> columnList = new ArrayList<String>();
+                    for (String s : columns) {
+                        if (!"".equals(s)) {
+                            columnList.add(s);
+                        }
+                    }
+                    lastStop = i + 1;
+                    statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
+                    break;
+                }
             }
         }
     }


Mime
View raw message