airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: fixing NPE s in recovery and process state update when output staging fail
Date Wed, 16 Sep 2015 18:27:50 GMT
Repository: airavata
Updated Branches:
  refs/heads/master a65c01e2b -> c87eb4270


fixing NPE s in recovery and process state update when output staging fail


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

Branch: refs/heads/master
Commit: c87eb4270bfb89953da252985e27d9037241a108
Parents: a65c01e
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Wed Sep 16 14:27:44 2015 -0400
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Wed Sep 16 14:27:44 2015 -0400

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java         | 11 +++++++++--
 .../org/apache/airavata/gfac/impl/GFacEngineImpl.java  |  7 +++++++
 .../gfac/impl/task/AdvancedSCPDataStageTask.java       | 13 ++++++++++---
 .../airavata/gfac/impl/task/SCPDataStageTask.java      |  2 +-
 4 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/c87eb427/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index d7a3668..2c6d3a3 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -34,6 +34,7 @@ import org.apache.airavata.model.error.*;
 import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
 import org.apache.airavata.model.security.AuthzToken;
 import org.apache.airavata.model.status.ExperimentState;
+import org.apache.airavata.model.status.JobStatus;
 import org.apache.airavata.model.util.ExperimentModelUtil;
 import org.apache.airavata.model.util.ProjectModelUtil;
 import org.apache.airavata.model.workspace.Gateway;
@@ -85,9 +86,15 @@ public class CreateLaunchExperiment {
     public static void main(String[] args) throws Exception {
         airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT);
         AuthzToken token = new AuthzToken("empty_token");
-        System.out.println("API version is " + airavataClient.getAPIVersion(null));
+        System.out.println("API version is " + airavataClient.getAPIVersion(token));
 //        registerApplications(); // run this only the first time
-        createAndLaunchExp();
+        Map<String, JobStatus> jobStatuses = airavataClient.getJobStatuses(token, "test_78ddc6f0-ddd1-4154-ba45-6d597b8c8f3b");
+        for (String jobId : jobStatuses.keySet()){
+            JobStatus jobStatus = jobStatuses.get(jobId);
+            System.out.println(jobId);
+            System.out.println(jobStatus.getJobState().toString());
+        }
+//        createAndLaunchExp();
     }
 
     private static String fsdResourceId;

http://git-wip-us.apache.org/repos/asf/airavata/blob/c87eb427/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
index c9f3782..c14e5bc 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
@@ -25,6 +25,7 @@ import org.apache.airavata.common.exception.AiravataException;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.ThriftUtils;
+import org.apache.airavata.gfac.core.GFac;
 import org.apache.airavata.gfac.core.GFacEngine;
 import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.GFacUtils;
@@ -405,6 +406,12 @@ public class GFacEngineImpl implements GFacEngine {
                         errorModel.setUserFriendlyMessage("Error while staging output data");
                         errorModel.setActualErrorMessage(errorMsg);
                         GFacUtils.saveTaskError(taskCtx, errorModel);
+                        ProcessStatus processStatus = processContext.getProcessStatus();
+                        processStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
+                        processStatus.setReason(errorMsg);
+                        processContext.setProcessStatus(processStatus);
+                        GFacUtils.saveAndPublishProcessStatus(processContext);
+                        GFacUtils.saveAndPublishProcessStatus(processContext);
 						throw new GFacException("Error while staging output data");
 					}
 					break;

http://git-wip-us.apache.org/repos/asf/airavata/blob/c87eb427/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
index 32931c7..4e70ac0 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
@@ -250,12 +250,19 @@ public class AdvancedSCPDataStageTask implements Task{
 
 	@Override
 	public TaskStatus recover(TaskContext taskContext) {
-		return null;
-	}
+        // FIXME - Recover gives NPE s because of this
+        TaskState state = taskContext.getTaskStatus().getState();
+        if (state == TaskState.EXECUTING || state == TaskState.CREATED) {
+            return execute(taskContext);
+        } else {
+            // files already transferred or failed
+            return taskContext.getTaskStatus();
+        }
+    }
 
 	@Override
 	public TaskTypes getType() {
-		return null;
+		return TaskTypes.DATA_STAGING;
 	}
 
 	private SSHPasswordAuthentication getSSHPasswordAuthentication() {

http://git-wip-us.apache.org/repos/asf/airavata/blob/c87eb427/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
index eecf57d..a653963 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
@@ -115,6 +115,6 @@ public class SCPDataStageTask implements Task {
 
 	@Override
 	public TaskTypes getType() {
-		return null;
+		return TaskTypes.DATA_STAGING;
 	}
 }


Mime
View raw message