You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2016/02/08 18:28:10 UTC

airavata git commit: fixing NPE at launch method

Repository: airavata
Updated Branches:
  refs/heads/master 4c7907706 -> 2bab21895


fixing NPE at launch method


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

Branch: refs/heads/master
Commit: 2bab21895ba24263f563bc6b24937548abd24acb
Parents: 4c79077
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Mon Feb 8 12:30:16 2016 -0500
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Mon Feb 8 12:30:16 2016 -0500

----------------------------------------------------------------------
 .../server/OrchestratorServerHandler.java       | 43 ++++++++++----------
 1 file changed, 22 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2bab2189/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 977191e..b0765ec 100644
--- a/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -140,30 +140,31 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
 			ZKPaths.mkdirs(curatorClient.getZookeeperClient().getZooKeeper(), experimentNodePath);
 			String experimentCancelNode = ZKPaths.makePath(experimentNodePath, ZkConstants.ZOOKEEPER_CANCEL_LISTENER_NODE);
 			ZKPaths.mkdirs(curatorClient.getZookeeperClient().getZooKeeper(), experimentCancelNode);
+            experiment = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
+            if (experiment == null) {
+                log.error(experimentId, "Error retrieving the Experiment by the given experimentID: {} ", experimentId);
+                return false;
+            }
 
-			ComputeResourcePreference computeResourcePreference = appCatalog.getGatewayProfile().
+            ComputeResourcePreference computeResourcePreference = appCatalog.getGatewayProfile().
 					getComputeResourcePreference(gatewayId,
 							experiment.getUserConfigurationData().getComputationalResourceScheduling().getResourceHostId());
-			String token = computeResourcePreference.getResourceSpecificCredentialStoreToken();
-			if (token == null || token.isEmpty()){
-				// try with gateway profile level token
-				GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(gatewayId);
-				token = gatewayProfile.getCredentialStoreToken();
-			}
-			// still the token is empty, then we fail the experiment
-			if (token == null || token.isEmpty()){
-				log.error("You have not configured credential store token at gateway profile or compute resource preference. Please provide the correct token at gateway profile or compute resource preference.");
-				return false;
-			}
-			ExperimentType executionType = experiment.getExperimentType();
-			if (executionType == ExperimentType.SINGLE_APPLICATION) {
-				//its an single application execution experiment
-				List<ProcessModel> processes = orchestrator.createProcesses(experimentId, gatewayId);
-				experiment = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
-				if (experiment == null) {
-					log.error(experimentId, "Error retrieving the Experiment by the given experimentID: {} ", experimentId);
-					return false;
-				}
+            String token = computeResourcePreference.getResourceSpecificCredentialStoreToken();
+            if (token == null || token.isEmpty()){
+                // try with gateway profile level token
+                GatewayResourceProfile gatewayProfile = appCatalog.getGatewayProfile().getGatewayProfile(gatewayId);
+                token = gatewayProfile.getCredentialStoreToken();
+            }
+            // still the token is empty, then we fail the experiment
+            if (token == null || token.isEmpty()){
+                log.error("You have not configured credential store token at gateway profile or compute resource preference. Please provide the correct token at gateway profile or compute resource preference.");
+                return false;
+            }
+            ExperimentType executionType = experiment.getExperimentType();
+            if (executionType == ExperimentType.SINGLE_APPLICATION) {
+                //its an single application execution experiment
+                List<ProcessModel> processes = orchestrator.createProcesses(experimentId, gatewayId);
+
 				for (ProcessModel processModel : processes){
 					String taskDag = orchestrator.createAndSaveTasks(gatewayId, processModel, experiment.getUserConfigurationData().isAiravataAutoSchedule());
 					processModel.setTaskDag(taskDag);