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/01/19 16:55:25 UTC

airavata git commit: fixing AIRAVATA-1416

Repository: airavata
Updated Branches:
  refs/heads/develop 113490efb -> 0c51c7aa1


fixing AIRAVATA-1416


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

Branch: refs/heads/develop
Commit: 0c51c7aa1154161f223a310e6052123ad8b2ed93
Parents: 113490e
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue Jan 19 10:56:29 2016 -0500
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue Jan 19 10:56:29 2016 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 33 ++++++++++++++------
 1 file changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/0c51c7aa/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index fecf861..0212163 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1838,6 +1838,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws AuthorizationException, TException {
     	try {
             experimentCatalog = RegistryFactory.getDefaultExpCatalog();
+            appCatalog = RegistryFactory.getAppCatalog();
 			if (!experimentCatalog.isExist(ExperimentCatalogModelType.EXPERIMENT, airavataExperimentId)) {
                 logger.error(airavataExperimentId, "Error while launching experiment, experiment {} doesn't exist.", airavataExperimentId);
                 throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
@@ -1846,21 +1847,35 @@ public class AiravataServerHandler implements Airavata.Iface {
                 logger.error(airavataExperimentId, "Error while launching experiment, gatewayId {} doesn't exist.", gatewayId);
                 throw new ExperimentNotFoundException("Requested gateway id " + gatewayId + " does not exist in the system..");
             }
+            ExperimentModel experiment = getExperimentInternal(airavataExperimentId);
+            String applicationID = experiment.getExecutionId();
+            if (!appCatalog.getApplicationInterface().isApplicationInterfaceExists(applicationID)){
+                logger.error(airavataExperimentId, "Error while launching experiment, application id {} for experiment {} doesn't exist.", applicationID, airavataExperimentId);
+                AiravataSystemException exception = new AiravataSystemException();
+                exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+                exception.setMessage("Error while launching experiment, application id : " + applicationID  + " for experiment : " + airavataExperimentId +
+                        " doesn't exist..");
+                throw exception;
+            }
+            OrchestratorService.Client orchestratorClient = getOrchestratorClient();
+            if (orchestratorClient.validateExperiment(airavataExperimentId)) {
+                orchestratorClient.launchExperiment(airavataExperimentId, gatewayId);
+                logger.info("Airavata launched experiment with experiment id : " + airavataExperimentId);
+            }else {
+                logger.error(airavataExperimentId, "Couldn't identify experiment type, experiment {} is neither single application nor workflow.", airavataExperimentId);
+                throw new InvalidRequestException("Experiment '" + airavataExperimentId + "' launch failed. Unable to figureout execution type for application " + applicationID);
+            }
         } catch (RegistryException e1) {
             logger.error(airavataExperimentId, "Error while instantiate the registry instance", e1);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while instantiate the registry instance. More info : " + e1.getMessage());
             throw exception;
-        }
-    	ExperimentModel experiment = getExperimentInternal(airavataExperimentId);
-    	OrchestratorService.Client orchestratorClient = getOrchestratorClient();
-    	if (orchestratorClient.validateExperiment(airavataExperimentId)) {
-    		orchestratorClient.launchExperiment(airavataExperimentId, gatewayId);
-            logger.info("Airavata launched experiment with experiment id : " + airavataExperimentId);
-    	}else {
-            logger.error(airavataExperimentId, "Couldn't identify experiment type, experiment {} is neither single application nor workflow.", airavataExperimentId);
-            throw new InvalidRequestException("Experiment '" + airavataExperimentId + "' launch failed. Unable to figureout execution type for application " + experiment.getExecutionId());
+        } catch (AppCatalogException e) {
+            logger.error(airavataExperimentId, "Error while instantiate the registry instance", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while instantiate the registry instance. More info : " + e.getMessage());
         }
     }