airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: Adding NPE fixes - AIRAVATA-1028
Date Fri, 28 Feb 2014 17:44:33 GMT
Repository: airavata
Updated Branches:
  refs/heads/master d29a148f6 -> ab54c7d5f


Adding NPE fixes - AIRAVATA-1028


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

Branch: refs/heads/master
Commit: ab54c7d5f2c33ca24a96a73bff9400ead8165ab0
Parents: d29a148
Author: lahiru <lahiru@apache.org>
Authored: Fri Feb 28 12:44:25 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Fri Feb 28 12:44:25 2014 -0500

----------------------------------------------------------------------
 .../apache/airavata/job/monitor/MonitorID.java  |  7 +++++++
 .../server/OrchestratorServerHandler.java       |  4 ++++
 .../client/OrchestratorClientFactoryTest.java   |  6 ++++--
 .../registry/jpa/resources/Utils.java           | 12 ++++++-----
 .../jpa/utils/ThriftDataModelConversion.java    | 22 +++++++++++++++-----
 5 files changed, 39 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ab54c7d5/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorID.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorID.java
index 5dee039..06d04ac 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorID.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorID.java
@@ -22,6 +22,7 @@ package org.apache.airavata.job.monitor;
 
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,6 +73,12 @@ public class MonitorID {
         this.jobStartedTime = new Timestamp((new Date()).getTime());
         this.authenticationInfo = authenticationInfo;
         this.userName = userName;
+        // if we give myproxyauthenticationInfo, so we try to use myproxy user as the user
+        if(this.authenticationInfo != null){
+            if(this.authenticationInfo instanceof MyProxyAuthenticationInfo){
+                this.userName = ((MyProxyAuthenticationInfo)this.authenticationInfo).getUserName();
+            }
+        }
         this.jobID = jobID;
         this.taskID = taskID;
         this.experimentID = experimentID;

http://git-wip-us.apache.org/repos/asf/airavata/blob/ab54c7d5/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 5136b18..9610a56 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
@@ -171,6 +171,10 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface
{
                 //iterate through all the generated tasks and performs the job submisssion+monitoring
 
                 Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentId);
+                if(experiment == null){
+                    log.error("Error retrieving the Experiment by the given experimentID:
" + experimentId);
+                    return false;
+                }
                 String userName = experiment.getUserName();
 
                 HostDescription hostDescription = OrchestratorUtils.getHostDescription(orchestrator,
taskID);

http://git-wip-us.apache.org/repos/asf/airavata/blob/ab54c7d5/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
index 4b5aef1..0b6e8b2 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/OrchestratorClientFactoryTest.java
@@ -47,12 +47,12 @@ import java.util.List;
 
 public class OrchestratorClientFactoryTest {
     private DocumentCreator documentCreator;
-//    private OrchestratorService.Client orchestratorClient;
+    private OrchestratorService.Client orchestratorClient;
     private Registry registry;
 
     @Before
     public void setUp(){
-//        orchestratorClient = OrchestratorClientFactory.createOrchestratorClient("localhost",
8940);
+        orchestratorClient = OrchestratorClientFactory.createOrchestratorClient("localhost",
8940);
         registry = RegistryFactory.getDefaultRegistry();
         AiravataUtils.setExecutionAsServer();
         documentCreator = new DocumentCreator(getAiravataAPI());
@@ -95,6 +95,8 @@ public class OrchestratorClientFactoryTest {
             String expId = (String)registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
             CompositeIdentifier compositeIdentifier = new CompositeIdentifier(expId, null);
             registry.add(ChildDataType.COMPUTATIONAL_RESOURCE_SCHEDULING, scheduling, compositeIdentifier);
+
+            orchestratorClient.launchExperiment(expId);
         } catch (Exception e) {
             e.printStackTrace();
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/ab54c7d5/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
index 44c85d3..e7bb865 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
@@ -566,12 +566,14 @@ public class Utils {
         ExperimentResource experimentResource = new ExperimentResource();
         GatewayResource gatewayResource = (GatewayResource)createGateway(o.getGateway());
         experimentResource.setGateway(gatewayResource);
-        Gateway_Worker gateway_worker = new Gateway_Worker();
-        gateway_worker.setGateway(o.getGateway());
-        gateway_worker.setUser_name(o.getExecutionUser());
+//        Gateway_Worker gateway_worker = new Gateway_Worker();
+//        gateway_worker.setGateway(o.getGateway());
+//        gateway_worker.setUser_name(o.getExecutionUser());
         experimentResource.setExecutionUser(o.getExecutionUser());
-        ProjectResource projectResource = (ProjectResource)createProject(o.getProject());
-        experimentResource.setProject(projectResource);
+        if (o.getProject() != null){
+            ProjectResource projectResource = (ProjectResource)createProject(o.getProject());
+            experimentResource.setProject(projectResource);
+        }
         experimentResource.setExpID(o.getExpId());
         experimentResource.setCreationTime(o.getCreationTime());
         experimentResource.setDescription(o.getExpDesc());

http://git-wip-us.apache.org/repos/asf/airavata/blob/ab54c7d5/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 3809a62..3f9ff66 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
@@ -34,7 +34,10 @@ public class ThriftDataModelConversion {
 
     public static Experiment getExperiment(ExperimentResource experimentResource){
         Experiment experiment = new Experiment();
-        experiment.setProjectID(experimentResource.getProject().getName());
+        if (experimentResource.getProject()!= null){
+            experiment.setProjectID(experimentResource.getProject().getName());
+        }
+
         experiment.setCreationTime(experimentResource.getCreationTime().getTime());
         experiment.setUserName(experimentResource.getExecutionUser());
         experiment.setName(experimentResource.getExpName());
@@ -49,13 +52,22 @@ public class ThriftDataModelConversion {
         List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs();
         experiment.setExperimentOutputs(getExpOutputs(experimentOutputs));
         StatusResource experimentStatus = experimentResource.getExperimentStatus();
-        experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
+        if (experimentStatus != null){
+            experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
+        }
         List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
-        experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
+        if (changeList != null){
+               experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
+        }
+
         List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
-        experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
+        if (workflowNodeDetails != null){
+                experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
+        }
         List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
-        experiment.setErrors(getErrorDetailList(errorDetails));
+        if (errorDetails!= null){
+            experiment.setErrors(getErrorDetailList(errorDetails));
+        }
         return experiment;
     }
 


Mime
View raw message