Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE067180C3 for ; Mon, 18 May 2015 20:58:32 +0000 (UTC) Received: (qmail 48835 invoked by uid 500); 18 May 2015 20:58:32 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 48785 invoked by uid 500); 18 May 2015 20:58:32 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 48775 invoked by uid 99); 18 May 2015 20:58:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2015 20:58:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8E967E07EB; Mon, 18 May 2015 20:58:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shameera@apache.org To: commits@airavata.apache.org Message-Id: <5f113a238a6749f2a8c28cec904101b6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: airavata git commit: Fixed Failed job cancel at abstract cluster level. Date: Mon, 18 May 2015 20:58:32 +0000 (UTC) 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 Authored: Mon May 18 16:58:28 2015 -0400 Committer: shamrath 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 {