airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [1/2] git commit: fixing AIRAVATA-1011
Date Tue, 11 Feb 2014 20:49:43 GMT
Updated Branches:
  refs/heads/master daa536fb2 -> cb78c9264


fixing AIRAVATA-1011


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

Branch: refs/heads/master
Commit: dea7937d2aca49de85bc3cbf3c091882c0b9457f
Parents: b1c3603
Author: lahiru <lahiru@apache.org>
Authored: Tue Feb 11 15:48:14 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Tue Feb 11 15:48:14 2014 -0500

----------------------------------------------------------------------
 .../org/apache/airavata/gfac/Scheduler.java     | 27 +++++++-
 .../org/apache/airavata/gfac/cpi/GFacAPI.java   |  1 -
 .../core/impl/EmbeddedGFACJobSubmitter.java     | 19 +++---
 .../cpi/impl/AbstractOrchestrator.java          |  1 +
 .../test/resources/airavata-client.properties   | 66 ++++++++++++++++++++
 .../src/test/resources/gfac-config.xml          | 13 +++-
 6 files changed, 110 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
index 5a2bf40..8d19de1 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
@@ -21,14 +21,22 @@
 
 package org.apache.airavata.gfac;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPathExpressionException;
 
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.gfac.context.JobExecutionContext;
@@ -37,6 +45,8 @@ import org.apache.airavata.gfac.provider.GFacProviderConfig;
 import org.apache.airavata.gfac.provider.GFacProviderException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
 
 
 /**
@@ -66,12 +76,27 @@ public class Scheduler {
     private static GFacProvider getProvider(JobExecutionContext jobExecutionContext) throws
GFacException {
         HostDescription hostDescription = jobExecutionContext.getApplicationContext().getHostDescription();
         String applicationName = jobExecutionContext.getServiceName();
+
+        URL resource = Scheduler.class.getClassLoader().getResource("gfac-config.xml");
+        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = null;
+        Document handlerDoc = null;
+        try {
+            docBuilder = docBuilderFactory.newDocumentBuilder();
+            handlerDoc = docBuilder.parse(new File(resource.getPath()));
+        } catch (ParserConfigurationException e) {
+            throw new GFacException(e);
+        } catch (SAXException e) {
+            throw new GFacException(e);
+        } catch (IOException e) {
+            throw new GFacException(e);
+        }
         GFacProviderConfig s = null;
         GFacProvider provider = null;
         List<GFacProviderConfig> aClass = null;
         String providerClassName = null;
         try {
-            aClass = GFacConfiguration.getProviderConfig(GFacConfiguration.getHandlerDoc(),
+            aClass = GFacConfiguration.getProviderConfig(handlerDoc,
                     Constants.XPATH_EXPR_APPLICATION_HANDLERS_START + applicationName + "']",
Constants.GFAC_CONFIG_APPLICATION_NAME_ATTRIBUTE);
             // This should be have a single element only.
             if (aClass != null && !aClass.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacAPI.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacAPI.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacAPI.java
index 8464750..55841da 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacAPI.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacAPI.java
@@ -63,7 +63,6 @@ public class GFacAPI {
         // the job.
         String experimentID = jobExecutionContext.getExperimentID();
         try {
-            AiravataRegistry2 registry2 = ((AiravataClient)jobExecutionContext.getGFacConfiguration().getAiravataAPI()).getRegistryClient();
             Scheduler.schedule(jobExecutionContext);
 
             // Executing in handlers in the order as they have configured in GFac configuration

http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
index cde97bd..729fdf4 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/impl/EmbeddedGFACJobSubmitter.java
@@ -45,6 +45,7 @@ import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
 import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
 import org.apache.airavata.orchestrator.core.job.JobSubmitter;
 import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
+import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.api.JobRequest;
 import org.apache.airavata.registry.cpi.DataType;
 import org.apache.airavata.registry.cpi.DependentDataType;
@@ -82,6 +83,7 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
                 launchGfacWithJobRequest(jobRequest);
             } catch (Exception e) {
                 logger.error("Error getting job related information");
+                throw new OrchestratorException(e);
             }
         }
         return true;
@@ -99,9 +101,6 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
         if (serviceName == null) {
             throw new OrchestratorException("Error executing the job because there is not
Application Name in this Experiment");
         }
-
-        //todo submit the jobs
-
         AiravataAPI airavataAPI = null;
         try {
 
@@ -109,11 +108,12 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
             //FIXME: (MEP) Why do all of this validation here?  Is it needed?  Why would
you get an empty job request?
             //FIXME: (MEP) If you do need this, it should go into a utility class or something
similar that does the validation.
             HostDescription hostDescription = jobRequest.getHostDescription();
+            AiravataRegistry2 registry = orchestratorContext.getRegistry();
             if (hostDescription == null) {
                 List<HostDescription> registeredHosts = new ArrayList<HostDescription>();
-                Map<String, ApplicationDescription> applicationDescriptors = airavataAPI.getApplicationManager().getApplicationDescriptors(serviceName);
+                Map<String, ApplicationDescription> applicationDescriptors = registry.getApplicationDescriptors(serviceName);
                 for (String hostDescName : applicationDescriptors.keySet()) {
-                    registeredHosts.add(airavataAPI.getApplicationManager().getHostDescription(hostDescName));
+                    registeredHosts.add(registry.getHostDescriptor(hostDescName));
                 }
                 Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class);
                 HostScheduler hostScheduler = aClass.newInstance();
@@ -122,17 +122,12 @@ public class EmbeddedGFACJobSubmitter implements JobSubmitter {
 
             ServiceDescription serviceDescription = jobRequest.getServiceDescription();
             if (serviceDescription == null) {
-                try {
-                    serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(jobRequest.getServiceName());
-                } catch (AiravataAPIInvocationException e) {
-                    String error = "Error retrieving document from Registry: " + jobRequest.getServiceName();
-                    throw new OrchestratorException(error, e);
-                }
+                    serviceDescription = registry.getServiceDescriptor(serviceName);
             }
 
             ApplicationDescription applicationDescription = jobRequest.getApplicationDescription();
             if (applicationDescription == null) {
-                applicationDescription = airavataAPI.getApplicationManager().getApplicationDescription(serviceName,
hostDescription.getType().getHostName());
+                applicationDescription = registry.getApplicationDescriptors(serviceName,
hostDescription.getType().getHostName());
             }
             // When we run getInParameters we set the actualParameter object, this has to
be fixed
             //FIXME: will these class loaders work correctly in Thrift?

http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
index 5699559..ce0ff47 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/AbstractOrchestrator.java
@@ -111,6 +111,7 @@ public abstract class AbstractOrchestrator implements Orchestrator {
             }
             orchestratorContext = new OrchestratorContext();
             orchestratorContext.setOrchestratorConfiguration(orchestratorConfiguration);
+            AiravataAPI airavataAPI = getAiravataAPI();
             orchestratorConfiguration.setAiravataAPI(getAiravataAPI());
             orchestratorContext.setRegistry(airavataRegistry);
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/orchestrator/orchestrator-core/src/test/resources/airavata-client.properties
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/resources/airavata-client.properties
b/modules/orchestrator/orchestrator-core/src/test/resources/airavata-client.properties
new file mode 100644
index 0000000..17c9c0c
--- /dev/null
+++ b/modules/orchestrator/orchestrator-core/src/test/resources/airavata-client.properties
@@ -0,0 +1,66 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+###########################################################################
+#
+#  This properties file provides configuration for Airavata Clients:
+#  XBaya and Airavata API
+#
+###########################################################################
+
+###---------------------------REGISTRY API IMPLEMENTATION---------------------------###
+
+class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
+
+###---------------------REGISTRY API IMPLEMENTATION - CUSTOM SETTINGS----------------------###
+
+#for mysql [AiravataJPARegistry]
+#registry.jdbc.driver=com.mysql.jdbc.Driver
+#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+
+#for derby [AiravataJPARegistry]
+registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+
+default.registry.user=admin
+default.registry.password=admin
+default.registry.password.hash.method=SHA
+default.registry.gateway=default
+
+#for xbaya
+xbaya.registry.user=admin
+xbaya.registry.url=http://localhost:8080/airavata/services/registry
+xbaya.default.gateway=default
+
+trust.store=aiaravata.jks
+trust.store.password=airavata
+
+#user defined registry accessor classes
+#class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.descriptor.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.project.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.user.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.published.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/dea7937d/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
index f03ecde..61dca4f 100644
--- a/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
+++ b/modules/orchestrator/orchestrator-core/src/test/resources/gfac-config.xml
@@ -9,7 +9,7 @@
     WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the
     License for the ~ specific language governing permissions and limitations
     ~ under the License. -->
-
+    
 <GFac>
     <GlobalHandlers>
         <InHandlers>
@@ -24,7 +24,7 @@
             <Handler class="org.apache.airavata.gfac.handler.LocalDirectorySetupHandler"/>
         </InHandlers>
     </Provider>
-   <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
+    <Provider class="org.apache.airavata.gfac.provider.impl.GramProvider" host="org.apache.airavata.schemas.gfac.impl.GlobusHostTypeImpl">
         <property name="name" value="value"/>
         <InHandlers>
             <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler">
@@ -36,7 +36,14 @@
             <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
         </OutHandlers>
     </Provider>
-    <Provider class="org.apache.airavata.gfac.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
+      <Provider class="org.apache.airavata.gfac.provider.impl.BESProvider" host="org.apache.airavata.schemas.gfac.impl.UnicoreHostTypeImpl">
+        <InHandlers>
+        	<Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+        </InHandlers>
+        <OutHandlers>
+            <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+        </OutHandlers>
     </Provider>
 
     <Provider class="org.apache.airavata.gfac.ec2.EC2Provider" host="org.apache.airavata.schemas.gfac.impl.Ec2HostTypeImpl">


Mime
View raw message