You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/05/18 22:58:32 UTC
airavata git commit: Fixed Failed job cancel at abstract cluster
level.
Repository: airavata
Updated Branches:
refs/heads/master 18748564f -> c11b6628c
Fixed Failed job cancel at abstract cluster level.
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/c11b6628
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/c11b6628
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/c11b6628
Branch: refs/heads/master
Commit: c11b6628c4ea871256501c5e93d17cd1391d9910
Parents: 1874856
Author: shamrath <sh...@gmail.com>
Authored: Mon May 18 16:58:28 2015 -0400
Committer: shamrath <sh...@gmail.com>
Committed: Mon May 18 16:58:28 2015 -0400
----------------------------------------------------------------------
.../gsi/ssh/impl/GSISSHAbstractCluster.java | 23 ++++++--------------
1 file changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/c11b6628/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 fd3dea7..022c92f 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,32 +237,23 @@ public class GSISSHAbstractCluster implements Cluster {
}
public synchronized JobDescriptor cancelJob(String jobID) throws SSHApiException {
- JobStatus jobStatus = getJobStatus(jobID);
- if (jobStatus == null || jobStatus == JobStatus.U) {
+ JobDescriptor jobDescriptorById = getJobDescriptorById(jobID);
+ if (jobDescriptorById.getStatus() == null || jobDescriptorById.getStatus().isEmpty()) {
+ return null;
+ }
+ JobStatus jobStatus = JobStatus.valueOf(jobDescriptorById.getStatus());
+ if (jobStatus == JobStatus.U || jobStatus == JobStatus.F) { // TODO: add other cases. Which lead to invalid cancel.
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());
// 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 {
- JobDescriptor jobById = this.getJobDescriptorById(jobID);
- if (CommonUtils.isJobFinished(jobById)) {
- log.debug("Job Cancel operation was successful !");
- return jobById;
- } else {
- log.debug("Job Cancel operation was not successful !");
- return null;
- }
- } catch (Exception e) {
- //its ok to fail to get status when the job is gone
- return null;
- }
+ return jobDescriptorById;
}
public synchronized String submitBatchJobWithScript(String scriptPath, String workingDirectory) throws SSHApiException {