Repository: airavata
Updated Branches:
  refs/heads/master 9564e89a5 -> 3dafb0067


Launch need to be update before launching as there are other stauts
updated at GFAC level. AIRAVATA-1273

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

Branch: refs/heads/master
Commit: 3dafb00672883ebd1e574f13528d1907c57aa5a2
Parents: 9564e89
Author: raminder <[email protected]>
Authored: Mon May 26 12:47:17 2014 -0400
Committer: raminder <[email protected]>
Committed: Mon May 26 12:47:17 2014 -0400

----------------------------------------------------------------------
 .../server/OrchestratorServerHandler.java       | 21 +++++++++++++-------
 .../registry/jpa/impl/ExperimentRegistry.java   |  2 +-
 .../resources/WorkflowNodeDetailResource.java   |  7 ++++---
 3 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3dafb006/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 2d677c9..3dd0625 100644
--- 
a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ 
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -80,7 +80,7 @@ public class OrchestratorServerHandler implements 
OrchestratorService.Iface {
      * @param experimentId
      */
     public boolean launchExperiment(String experimentId) throws TException {
-        //TODO: Write the Orchestrator implementaion
+       Experiment experiment= null;
         try {
             List<String> ids = 
registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL,WorkflowNodeConstants.EXPERIMENT_ID,experimentId);
             for (String workflowNodeId : ids) {
@@ -89,21 +89,18 @@ public class OrchestratorServerHandler implements 
OrchestratorService.Iface {
                 for (Object o : taskDetailList) {
                     TaskDetails taskID = (TaskDetails) o;
                     //iterate through all the generated tasks and performs the 
job submisssion+monitoring
-                    Experiment experiment = (Experiment) 
registry.get(RegistryModelType.EXPERIMENT, experimentId);
+                    experiment = (Experiment) 
registry.get(RegistryModelType.EXPERIMENT, experimentId);
                     if (experiment == null) {
                         log.error("Error retrieving the Experiment by the 
given experimentID: " + experimentId);
                         return false;
                     }
-
-                    //launching the experiment
-                    orchestrator.launchExperiment(experiment, 
workflowNodeDetail, taskID);
-
-                    // after a successful launch update the experiment status 
to launched
                     ExperimentStatus status = new ExperimentStatus();
                     status.setExperimentState(ExperimentState.LAUNCHED);
                     
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
                     experiment.setExperimentStatus(status);
                     registry.update(RegistryModelType.EXPERIMENT, experiment, 
experimentId);
+                    //launching the experiment
+                    orchestrator.launchExperiment(experiment, 
workflowNodeDetail, taskID);
                 }
             }
 
@@ -112,6 +109,16 @@ public class OrchestratorServerHandler implements 
OrchestratorService.Iface {
             // is in gfac, if there are errors in gfac, it will handle the 
experiment/task/job statuses
             // We might get failures in registry access before submitting the 
jobs to gfac, in that case we
             // leave the status of these as created.
+            ExperimentStatus status = new ExperimentStatus();
+            status.setExperimentState(ExperimentState.FAILED);
+            
status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+            experiment.setExperimentStatus(status);
+            try {
+                               registry.update(RegistryModelType.EXPERIMENT, 
experiment, experimentId);
+                       } catch (RegistryException e1) {
+                                throw new TException(e);
+                       }
+      
             throw new TException(e);
         }
         return true;

http://git-wip-us.apache.org/repos/asf/airavata/blob/3dafb006/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 ff476be..9bc55ec 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
@@ -495,7 +495,7 @@ public class ExperimentRegistry {
             TaskDetailResource taskDetail = workflowNode.getTaskDetail(taskId);
             StatusResource statusResource;
             if (taskDetail.isTaskStatusExist(taskId)){
-                statusResource = workflowNode.geTaskStatus(taskId);
+                statusResource = workflowNode.getTaskStatus(taskId);
             } else {
                 statusResource = 
(StatusResource)taskDetail.create(ResourceType.STATUS);
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3dafb006/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
----------------------------------------------------------------------
diff --git 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
index 05d8671..559080f 100644
--- 
a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
+++ 
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkflowNodeDetailResource.java
@@ -361,7 +361,7 @@ public class WorkflowNodeDetailResource extends 
AbstractResource {
         return null;
     }
 
-    public StatusResource geTaskStatus(String taskId){
+    public StatusResource getTaskStatus(String taskId){
         List<Resource> resources = get(ResourceType.STATUS);
         for (Resource resource : resources) {
             StatusResource taskStatus = (StatusResource) resource;
@@ -369,8 +369,9 @@ public class WorkflowNodeDetailResource extends 
AbstractResource {
                 if (taskStatus.getState() == null || 
taskStatus.getState().equals("") ){
                     taskStatus.setState("UNKNOWN");
                 }
-                return taskStatus;
-            }
+               
+            } 
+            return taskStatus;
         }
         return null;
     }

Reply via email to