airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject airavata git commit: fixing monitoring issues with LSF
Date Sat, 07 Mar 2015 06:18:06 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 565b5a3f4 -> 04cecb4d4


fixing monitoring issues with LSF


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

Branch: refs/heads/master
Commit: 04cecb4d4c2d52883ca03cd5791c1031b7d2bd6c
Parents: 565b5a3
Author: Lahiru Gunathilake <glahiru@gmail.com>
Authored: Sat Mar 7 01:18:03 2015 -0500
Committer: Lahiru Gunathilake <glahiru@gmail.com>
Committed: Sat Mar 7 01:18:03 2015 -0500

----------------------------------------------------------------------
 .../monitor/impl/pull/qstat/ResourceConnection.java   | 12 ++++++------
 .../apache/airavata/gfac/ssh/util/GFACSSHUtils.java   | 14 +++++++++++---
 .../airavata/gsi/ssh/api/job/LSFOutputParser.java     |  7 ++++---
 3 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/04cecb4d/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
index e13d907..f718535 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@ -113,27 +113,27 @@ public class ResourceConnection {
     private JobState getStatusFromString(String status) {
         log.info("parsing the job status returned : " + status);
         if (status != null) {
-            if ("C".equals(status) || "CD".equals(status) || "E".equals(status) || "CG".equals(status))
{
+            if ("C".equals(status) || "CD".equals(status) || "E".equals(status) || "CG".equals(status)
|| "DONE".equals(status)) {
                 return JobState.COMPLETE;
             } else if ("H".equals(status) || "h".equals(status)) {
                 return JobState.HELD;
-            } else if ("Q".equals(status) || "qw".equals(status)) {
+            } else if ("Q".equals(status) || "qw".equals(status) || "PEND".equals(status))
{
                 return JobState.QUEUED;
-            } else if ("R".equals(status) || "CF".equals(status) || "r".equals(status)) {
+            } else if ("R".equals(status) || "CF".equals(status) || "r".equals(status) ||
"RUN".equals(status)) {
                 return JobState.ACTIVE;
             } else if ("T".equals(status)) {
                 return JobState.HELD;
             } else if ("W".equals(status) || "PD".equals(status)) {
                 return JobState.QUEUED;
-            } else if ("S".equals(status)) {
+            } else if ("S".equals(status) || "PSUSP".equals(status) || "USUSP".equals(status)
|| "SSUSP".equals(status)) {
                 return JobState.SUSPENDED;
             } else if ("CA".equals(status)) {
                 return JobState.CANCELED;
-            } else if ("F".equals(status) || "NF".equals(status) || "TO".equals(status))
{
+            } else if ("F".equals(status) || "NF".equals(status) || "TO".equals(status) ||
"EXIT".equals(status)) {
                 return JobState.FAILED;
             } else if ("PR".equals(status) || "Er".equals(status)) {
                 return JobState.FAILED;
-            } else if ("U".equals(status)) {
+            } else if ("U".equals(status) || ("UNKWN".equals(status))) {
                 return JobState.UNKNOWN;
             }
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/04cecb4d/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
index c4d25f5..890768a 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@ -325,9 +325,7 @@ public class GFACSSHUtils {
         if (computationalProjectAccount != null) {
             jobDescriptor.setAcountString(computationalProjectAccount);
         }
-        Random random = new Random();
-        int i = random.nextInt(Integer.MAX_VALUE);
-        jobDescriptor.setJobName(String.valueOf(i + 99999999));
+        jobDescriptor.setJobName(String.valueOf(generateJobName()));
         jobDescriptor.setWorkingDirectory(jobExecutionContext.getWorkingDir());
 
         List<String> inputValues = new ArrayList<String>();
@@ -455,6 +453,16 @@ public class GFACSSHUtils {
         return jobDescriptor;
     }
 
+    private static int generateJobName() {
+        Random random = new Random();
+        int i = random.nextInt(Integer.MAX_VALUE);
+        i = i + 99999999;
+        if(i<0) {
+            i = i * (-1);
+        }
+        return i;
+    }
+
     private static String parseCommand(String value, JobExecutionContext jobExecutionContext)
{
         String parsedValue = value.replaceAll("\\$workingDir", jobExecutionContext.getWorkingDir());
         parsedValue = parsedValue.replaceAll("\\$inputDir", jobExecutionContext.getInputDir());

http://git-wip-us.apache.org/repos/asf/airavata/blob/04cecb4d/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/LSFOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/LSFOutputParser.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/LSFOutputParser.java
index bd02e37..71c3339 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/LSFOutputParser.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/LSFOutputParser.java
@@ -94,16 +94,17 @@ public class LSFOutputParser implements OutputParser {
         String test = "Job <2477982> is submitted to queue <short>.";
         System.out.println(test.substring(test.indexOf("<")+1, test.indexOf(">")));
         String test1 = "JOBID   USER    STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME
  SUBMIT_TIME\n" +
-                "2477983 cjh     RUN   short      ghpcc05     c17b06      *sleep_300 Feb
25 10:25";
+                "2636607 lg11w   RUN   long       ghpcc06     c11b02      *069656647 Mar
 7 00:58\n" +
+                "2636582 lg11w   RUN   long       ghpcc06     c02b01      2134490944 Mar
 7 00:48";
         Map<String, JobStatus> statusMap = new HashMap<String, JobStatus>();
-        statusMap.put("2477983,*sleep_300", JobStatus.U);
+        statusMap.put("2477983,2134490944", JobStatus.U);
         LSFOutputParser lsfOutputParser = new LSFOutputParser();
         try {
             lsfOutputParser.parseJobStatuses("cjh", statusMap, test1);
         } catch (SSHApiException e) {
             logger.error(e.getMessage(), e);
         }
-        System.out.println(statusMap.get("2477983,*sleep_300"));
+        System.out.println(statusMap.get("2477983,2134490944"));
 
     }
 }


Mime
View raw message