airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Reade gateway Id from credential token and identify the experiment execution type
Date Thu, 19 Mar 2015 21:03:31 GMT
Repository: airavata
Updated Branches:
  refs/heads/new-workflow-design d3f67fd85 -> 2b45c6d95


Reade gateway Id from credential token and identify the experiment execution type


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

Branch: refs/heads/new-workflow-design
Commit: 2b45c6d95f083fc5a3964c9e64e2daea55e25b86
Parents: d3f67fd
Author: shamrath <shameerainfo@gmail.com>
Authored: Thu Mar 19 17:03:44 2015 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Thu Mar 19 17:03:44 2015 -0400

----------------------------------------------------------------------
 modules/credential-store/pom.xml                | 19 ++++++-----------
 .../server/OrchestratorServerHandler.java       | 22 +++++++++++++++-----
 .../orchestrator/util/DataModelUtils.java       |  8 +++----
 3 files changed, 26 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2b45c6d9/modules/credential-store/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/pom.xml b/modules/credential-store/pom.xml
index 370cc9b..af4bc58 100644
--- a/modules/credential-store/pom.xml
+++ b/modules/credential-store/pom.xml
@@ -23,19 +23,12 @@
     <name>Airavata Credential Store</name>
     <url>http://airavata.apache.org/</url>
 
-    <profiles>
-        <profile>
-            <id>default</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <modules>
-                <module>credential-store-service</module>
-                <module>credential-store-stubs</module>
-                <module>credential-store-webapp</module>
-            </modules>
-        </profile>
-    </profiles>
+    <modules>
+        <module>credential-store-service</module>
+        <module>credential-store-stubs</module>
+        <module>credential-store-webapp</module>
+    </modules>
+
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b45c6d9/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 fe306d7..4209bb9 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
@@ -236,7 +236,19 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
                 log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID:
{} ", experimentId);
                 return false;
             }
-            ExecutionType executionType = DataModelUtils.getExecutionType(experiment);
+            CredentialReader credentialReader = GFacUtils.getCredentialReader();
+            String gatewayId = null;
+            if (credentialReader != null) {
+                try {
+                    gatewayId = credentialReader.getGatewayID(token);
+                } catch (Exception e) {
+                    log.error(e.getLocalizedMessage());
+                }
+            }
+            if (gatewayId == null) {
+                throw new AiravataException("Couldn't identify the gateway Id using the credential
token");
+            }
+            ExecutionType executionType = DataModelUtils.getExecutionType(gatewayId, experiment);
             synchronized (this) {
       		if (executionType==ExecutionType.SINGLE_APP) {
                   //its an single application execution experiment
@@ -247,10 +259,10 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
   					//its a workflow execution experiment
                   log.debugId(experimentId, "Launching workflow experiment {}.", experimentId);
   				  launchWorkflowExperiment(experimentId, token);
-  	          } else {
-                  log.errorId(experimentId, "Couldn't identify experiment type, experiment
{} is neither single application nor workflow.", experimentId);
-                  throw new TException("Experiment '" + experimentId + "' launch failed.
Unable to figureout execution type for application " + experiment.getApplicationId());
-              }
+            } else {
+                log.errorId(experimentId, "Couldn't identify experiment type, experiment
{} is neither single application nor workflow.", experimentId);
+                throw new TException("Experiment '" + experimentId + "' launch failed. Unable
to figureout execution type for application " + experiment.getApplicationId());
+            }
           }
          }catch(Exception e){
              throw new TException("Experiment '" + experimentId + "' launch failed. Unable
to figureout execution type for application " + experiment.getApplicationId());

http://git-wip-us.apache.org/repos/asf/airavata/blob/2b45c6d9/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
index 3243eb8..b6f8387 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 public class DataModelUtils {
 
     private final static Logger logger = LoggerFactory.getLogger(DataModelUtils.class);
-	public static ExecutionType getExecutionType(Experiment experiment){
+	public static ExecutionType getExecutionType(String gatewayId, Experiment experiment){
 		try {
 			ApplicationInterface applicationInterface = AppCatalogFactory.getAppCatalog().getApplicationInterface();
 			List<String> allApplicationInterfaceIds = applicationInterface.getAllApplicationInterfaceIds();
@@ -45,16 +45,14 @@ public class DataModelUtils {
 			if (allApplicationInterfaceIds.contains(applicationId)){
 				return ExecutionType.SINGLE_APP;
 			} else {
-				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(ServerSettings.getDefaultUserGateway());
+				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(gatewayId);
 				if (allWorkflows.contains(applicationId)){
 					return ExecutionType.WORKFLOW;
 				}
 			}
 		} catch (AppCatalogException e) {
 			logger.error(e.getMessage(), e);
-		} catch (ApplicationSettingsException e) {
-            logger.error(e.getMessage(), e);
-        }
+		}
         return ExecutionType.UNKNOWN;
 	}
 }


Mime
View raw message