airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] git commit: FIXING slurm monitoring issues - AIRAVATA-1057
Date Fri, 07 Mar 2014 17:48:48 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 99dd1bacc -> c45875eed


FIXING slurm monitoring issues - AIRAVATA-1057


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

Branch: refs/heads/master
Commit: de5aa33ae1bf61767c6bd8b2948494c4ae952251
Parents: 0f7a194
Author: lahiru <lahiru@apache.org>
Authored: Fri Mar 7 12:47:46 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Fri Mar 7 12:47:46 2014 -0500

----------------------------------------------------------------------
 .../job/monitor/impl/pull/qstat/QstatMonitor.java  |  2 ++
 .../impl/pull/qstat/ResourceConnection.java        |  4 +++-
 .../airavata/job/monitor/state/JobStatus.java      | 17 ++++++++++++++++-
 .../gsi/ssh/api/job/SlurmOutputParser.java         |  7 ++-----
 4 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/de5aa33a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
index cdb52b4..a2c85ed 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
@@ -152,6 +152,7 @@ public class QstatMonitor extends PullMonitor implements Runnable {
                 logger.error("Error handling the job with Job ID:" + take.getJobID());
                 throw new AiravataMonitorException(e);
             } catch (SSHApiException e) {
+                logger.error(e.getMessage());
                 if(e.getMessage().contains("Unknown Job Id Error")){
                     // in this case job is finished or may be the given job ID is wrong
                     jobStatus.setState(JobState.UNKNOWN);
@@ -180,6 +181,7 @@ public class QstatMonitor extends PullMonitor implements Runnable {
                         e1.printStackTrace();
                     }
                 } else {
+                    logger.error(e.getMessage());
                     logger.error("Tryied to monitor the job 3 times, so dropping of the the
Job with ID: " + take.getJobID());
                 }
                 throw new AiravataMonitorException("Error retrieving the job status", e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/de5aa33a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
index d5fb4b0..5155338 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
@@ -90,8 +90,10 @@ public class ResourceConnection {
                 return JobState.FAILED;
             }else if ("PR".equals(status)) {
                 return JobState.FAILED;
+            }else if ("U".equals(status)){
+                return JobState.UNKNOWN;
             }
         }
-        return null;
+        return JobState.UNKNOWN;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/de5aa33a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatus.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatus.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatus.java
index e062757..9ee6ce8 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatus.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatus.java
@@ -43,7 +43,22 @@ public class JobStatus {
     }
 
     public void setState(JobState state) {
-        this.state = state;
+        // this is to handle quick change of status and getStatus returns unknown values
+        // because job is already finished and information is removed in the resource
+        if (this.state != null && state.equals(JobState.UNKNOWN)) {
+            switch (this.state) {
+                case ACTIVE:
+                    this.state = JobState.COMPLETE;
+                    break;
+                case QUEUED:
+                    this.state = JobState.COMPLETE;
+                    break;
+
+            }
+        }else{
+            // normal scenario
+            this.state = state;
+        }
     }
 
     public MonitorID getMonitorID() {

http://git-wip-us.apache.org/repos/asf/airavata/blob/de5aa33a/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 8a60794..b3f41cb 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
@@ -103,14 +103,11 @@ public class SlurmOutputParser implements OutputParser {
         String lastString = info[info.length -1];
         if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
             // because there's no state
-            return JobStatus.valueOf("F");
+            return JobStatus.valueOf("U");
         }else{
             int column = 0;
-            System.out.println(lastString);
             for(String each:lastString.split(" ")){
-                if(each.trim().isEmpty()){
-                    continue;
-                }else{
+                if(!each.trim().isEmpty()){
                     switch (column){
                         case 0:
                             column++;


Mime
View raw message