airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: verify job in remote host before cancel operation.
Date Mon, 18 May 2015 15:03:47 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 8ae827d91 -> 0a3ab51f8


verify job in remote host before cancel operation.


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

Branch: refs/heads/master
Commit: 0a3ab51f86eb6f87f58720f6573d1115ba34a016
Parents: 8ae827d
Author: shamrath <shameerainfo@gmail.com>
Authored: Mon May 18 11:03:42 2015 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Mon May 18 11:03:42 2015 -0400

----------------------------------------------------------------------
 .../airavata/gfac/ssh/provider/impl/SSHProvider.java     |  7 +++++--
 .../airavata/gsi/ssh/impl/GSISSHAbstractCluster.java     | 11 ++++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0a3ab51f/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
index 805eee8..b5c94e2 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
@@ -260,8 +260,11 @@ public class SSHProvider extends AbstractProvider {
             }
             try {
                 if (jobDetails.getJobID() != null) {
-                    cluster.cancelJob(jobDetails.getJobID());
-                    GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.CANCELED,
monitorPublisher);
+                    if (cluster.cancelJob(jobDetails.getJobID()) != null) {
+                        GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.CANCELED,
monitorPublisher);
+                    } else {
+                        log.info("Job Cancel operation failed");
+                    }
                 } else {
                     log.error("No Job Id is set, so cannot perform the cancel operation !!!");
                     throw new GFacProviderException("Cancel request failed to cancel job
as JobId is null in Job Execution Context");

http://git-wip-us.apache.org/repos/asf/airavata/blob/0a3ab51f/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
index 3c2293d..fd3dea7 100644
--- a/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
+++ b/tools/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/GSISSHAbstractCluster.java
@@ -237,12 +237,17 @@ public class GSISSHAbstractCluster implements Cluster {
     }
 
     public synchronized JobDescriptor cancelJob(String jobID) throws SSHApiException {
-       RawCommandInfo rawCommandInfo = jobManagerConfiguration.getCancelCommand(jobID);
+        JobStatus jobStatus = getJobStatus(jobID);
+        if (jobStatus == null || jobStatus == JobStatus.U) {
+            log.info("Validation before cancel is failed, couldn't found job in remote host
to cancel. Job may be already completed|failed|canceled");
+            return null;
+        }
+        RawCommandInfo rawCommandInfo = jobManagerConfiguration.getCancelCommand(jobID);
 
         StandardOutReader stdOutReader = new StandardOutReader();
         log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
         CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
-        String outputifAvailable = getOutputifAvailable(stdOutReader, "Error reading output
of job submission",jobManagerConfiguration.getBaseCancelCommand());
+        String outputifAvailable = getOutputifAvailable(stdOutReader, "Error reading output
of job submission", jobManagerConfiguration.getBaseCancelCommand());
         // this might not be the case for all teh resources, if so Cluster implementation
can override this method
         // because here after cancelling we try to get the job description and return it
back
         try {
@@ -254,7 +259,7 @@ public class GSISSHAbstractCluster implements Cluster {
                 log.debug("Job Cancel operation was not successful !");
                 return null;
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             //its ok to fail to get status when the job is gone
             return null;
         }


Mime
View raw message