airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: fixing node status empty issue when getting experiments
Date Tue, 11 Mar 2014 18:57:54 GMT
Repository: airavata
Updated Branches:
  refs/heads/master fc64bd051 -> 12dd3c684


fixing node status empty issue when getting experiments


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

Branch: refs/heads/master
Commit: 12dd3c6846902f9b07b5cc6d895af6a90571e009
Parents: fc64bd0
Author: chathuri <chathuri@apache.org>
Authored: Tue Mar 11 14:57:48 2014 -0400
Committer: chathuri <chathuri@apache.org>
Committed: Tue Mar 11 14:57:48 2014 -0400

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java  |  1 +
 .../registry/jpa/impl/ExperimentRegistry.java   | 34 +++++++++++++++-----
 .../jpa/resources/ExperimentResource.java       |  4 +--
 .../jpa/resources/TaskDetailResource.java       |  2 +-
 .../jpa/utils/ThriftDataModelConversion.java    |  6 ++--
 5 files changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/12dd3c68/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 7a129c4..aca7b59 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
@@ -71,6 +71,7 @@ public class CreateLaunchExperiment {
             List<Experiment> experiments = getExperimentsForUser(airavata, "admin");
             for (Experiment exp : experiments){
                 System.out.println(" exp id : " + exp.getExperimentID());
+                System.out.println(" exp status : " + exp.getExperimentStatus().getExperimentState().toString());
             }
 
 //            try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/12dd3c68/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 28b8dbe..1f85e64 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -654,14 +654,23 @@ public class ExperimentRegistry {
                 addNodeOutputs(nodeOutputs, ids);
             }
             WorkflowNodeStatus workflowNodeStatus = nodeDetails.getWorkflowNodeStatus();
-            if (workflowNodeStatus != null){
-                WorkflowNodeStatus status = getWorkflowNodeStatus(nodeId);
-                if (status != null){
-                    updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
+            CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
+            if (workflowNodeStatus != null ){
+                if (workflowNodeStatus.getWorkflowNodeState() != null){
+                    WorkflowNodeStatus status = getWorkflowNodeStatus(nodeId);
+                    if (status != null){
+                        updateWorkflowNodeStatus(workflowNodeStatus, nodeId);
+                    }else {
+                        addWorkflowNodeStatus(workflowNodeStatus,ids);
+                    }
                 }else {
-                    CompositeIdentifier ids = new CompositeIdentifier(expId, nodeId);
-                    addWorkflowNodeStatus(workflowNodeStatus,ids);
+                    workflowNodeStatus.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
+                    addWorkflowNodeStatus(workflowNodeStatus, ids);
                 }
+            }else {
+                WorkflowNodeStatus status = new WorkflowNodeStatus();
+                status.setWorkflowNodeState(WorkflowNodeState.UNKNOWN);
+                addWorkflowNodeStatus(status, ids);
             }
             List<TaskDetails> taskDetails = nodeDetails.getTaskDetailsList();
             if (taskDetails != null && !taskDetails.isEmpty()){
@@ -825,9 +834,18 @@ public class ExperimentRegistry {
             }
 
             TaskStatus taskStatus = taskDetails.getTaskStatus();
+            CompositeIdentifier ids = new CompositeIdentifier(nodeId, taskDetail.getTaskId());
             if (taskStatus != null){
-                CompositeIdentifier ids = new CompositeIdentifier(nodeId, taskDetail.getTaskId());
-                addTaskStatus(taskStatus, ids);
+                if (taskStatus.getExecutionState() != null){
+                    addTaskStatus(taskStatus, ids);
+                }else {
+                    taskStatus.setExecutionState(TaskState.UNKNOWN);
+                    addTaskStatus(taskStatus, ids);
+                }
+            }else {
+                TaskStatus status = new TaskStatus();
+                status.setExecutionState(TaskState.UNKNOWN);
+                addTaskStatus(status, ids);
             }
             return taskDetail.getTaskId();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/12dd3c68/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
index e4a30d1..4873181 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentResource.java
@@ -578,7 +578,7 @@ public class ExperimentResource extends AbstractResource {
         List<Resource> resources = get(ResourceType.STATUS);
         for (Resource resource : resources) {
             StatusResource expStatus = (StatusResource) resource;
-            if(expStatus.getStatusType().equals(StatusType.EXPERIMENT)){
+            if(expStatus.getStatusType().equals(StatusType.EXPERIMENT.toString())){
                 return expStatus;
             }
         }
@@ -590,7 +590,7 @@ public class ExperimentResource extends AbstractResource {
         List<Resource> resources = get(ResourceType.STATUS);
         for (Resource resource : resources) {
             StatusResource workflowNodeStatus = (StatusResource) resource;
-            if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE)){
+            if(workflowNodeStatus.getStatusType().equals(StatusType.WORKFLOW_NODE.toString())){
                 statuses.add(workflowNodeStatus);
             }
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/12dd3c68/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
index 75194b0..4faa9af 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/TaskDetailResource.java
@@ -474,7 +474,7 @@ public class TaskDetailResource extends AbstractResource {
         List<Resource> resources = get(ResourceType.STATUS);
         for (Resource resource : resources) {
             StatusResource taskStatus = (StatusResource) resource;
-            if(taskStatus.getStatusType().equals(StatusType.TASK)){
+            if(taskStatus.getStatusType().equals(StatusType.TASK.toString())){
                 return taskStatus;
             }
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/12dd3c68/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
index 0b7d923..5ed0bce 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
@@ -80,16 +80,16 @@ public class ThriftDataModelConversion {
                 experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
             }
             List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
-            if (changeList != null){
+            if (changeList != null && !changeList.isEmpty()){
                 experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
             }
 
             List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
-            if (workflowNodeDetails != null){
+            if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){
                 experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
             }
             List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
-            if (errorDetails!= null){
+            if (errorDetails!= null && !errorDetails.isEmpty()){
                 experiment.setErrors(getErrorDetailList(errorDetails));
             }
             String expID = experimentResource.getExpID();


Mime
View raw message