airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: when job failed, output handlers should only download standarad out and standared error
Date Wed, 20 May 2015 19:09:56 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 9f8e68b42 -> 0af085f4a


when job failed, output handlers should only download standarad out and standared error


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

Branch: refs/heads/master
Commit: 0af085f4a6e900a2a3772a09c7fa39ceae022613
Parents: 9f8e68b
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Wed May 20 15:09:47 2015 -0400
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Wed May 20 15:09:47 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/airavata/gfac/core/utils/GFacUtils.java  | 8 ++++++++
 .../airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java  | 4 ++++
 .../org/apache/airavata/gfac/ssh/util/HandleOutputs.java     | 5 +++++
 3 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0af085f4/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index 09adb7a..8b62425 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -756,4 +756,12 @@ public class GFacUtils {
         airavataRegistry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
         return details.getExperimentStatus().getExperimentState();
     }
+
+    public static boolean isFailedJob (JobExecutionContext jec) {
+        JobStatus jobStatus = jec.getJobDetails().getJobStatus();
+        if (jobStatus.getJobState() == JobState.FAILED) {
+            return true;
+        }
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/0af085f4/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index efed1bc..0a2aa8d 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -148,6 +148,10 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
             for (String paramName : keys) {
                 OutputDataObjectType outputDataObjectType = (OutputDataObjectType) output.get(paramName);
                 if (outputDataObjectType.getType() == DataType.URI) {
+                    // for failed jobs outputs are not generated. So we should not download
outputs
+                    if (GFacUtils.isFailedJob(jobExecutionContext)){
+                        continue;
+                    }
                 	String downloadFile = outputDataObjectType.getValue();
                     if(downloadFile == null || !(new File(downloadFile).isFile())){
                         GFacUtils.saveErrorDetails(jobExecutionContext, "Empty Output returned
from the application", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);

http://git-wip-us.apache.org/repos/asf/airavata/blob/0af085f4/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
index ddab0f4..704528f 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/HandleOutputs.java
@@ -7,6 +7,7 @@ import java.util.List;
 
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.apache.airavata.gfac.core.utils.GFacUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
 import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
@@ -34,6 +35,10 @@ public class HandleOutputs {
 				// FIXME: Validation of outputs based on required and optional and search based on REGEX
provided in search.
 
 				if (DataType.URI == output.getType()) {
+                    // for failed jobs outputs are not generated. So we should not download
outputs
+                    if (GFacUtils.isFailedJob(jobExecutionContext)){
+                       continue;
+                    }
 					String outputFile = output.getValue();
 					String fileName = outputFile.substring(outputFile.lastIndexOf(File.separatorChar) +
1, outputFile.length());
 


Mime
View raw message