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: more changes to new gfac-cpi and orchestrator usage - AIRAVATA-1011
Date Wed, 12 Feb 2014 20:42:38 GMT
Updated Branches:
  refs/heads/master 8ee118864 -> e59e25ec3


more changes to new gfac-cpi and orchestrator usage - AIRAVATA-1011


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

Branch: refs/heads/master
Commit: 6f604649e7222308581ac9f3f5d4145f89500389
Parents: 029e604
Author: lahiru <lahiru@apache.org>
Authored: Wed Feb 12 15:42:15 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Wed Feb 12 15:42:15 2014 -0500

----------------------------------------------------------------------
 .../airavata/api/server/AiravataServer.java     |  1 +
 .../java/org/apache/airavata/gfac/cpi/GFac.java | 40 +++++++++++++-------
 .../registry/jpa/impl/AiravataJPARegistry.java  | 14 -------
 3 files changed, 28 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6f604649/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataServer.java
index a81bfd6..7a246ee 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataServer.java
@@ -40,6 +40,7 @@ public class AiravataServer {
     //FIXME: Read the port from airavata-server.config file
     private static final int THRIFT_SERVER_PORT = 8930;
 
+
     public static void StartAiravataServer(Airavata.Processor<MockAiravataServerHandler>
mockAiravataServer) throws AiravataSystemException {
         try {
             TServerTransport serverTransport = new TServerSocket(THRIFT_SERVER_PORT);

http://git-wip-us.apache.org/repos/asf/airavata/blob/6f604649/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
index c4ea71b..2abef52 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFac.java
@@ -37,12 +37,19 @@ import org.apache.airavata.model.experiment.ConfigurationData;
 import org.apache.airavata.registry.api.AiravataRegistry2;
 import org.apache.airavata.registry.cpi.DataType;
 import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.net.URL;
 import java.util.*;
 
+/**
+ * This is the GFac CPI class for external usage, this simply have a single method to submit
a job to
+ * the resource, required data for the job has to be stored in registry prior to invoke this
object.
+ */
 public class GFac {
+    private static final Logger log = LoggerFactory.getLogger(GFac.class);
 
     private Registry registry;
 
@@ -50,15 +57,28 @@ public class GFac {
 
     private AiravataRegistry2 airavataRegistry2;
 
+    /**
+     * Constructor for GFac
+     * @param registry
+     * @param airavataAPI
+     * @param airavataRegistry2
+     */
     public GFac(Registry registry, AiravataAPI airavataAPI, AiravataRegistry2 airavataRegistry2)
{
         this.registry = registry;
         this.airavataAPI = airavataAPI;
         this.airavataRegistry2 = airavataRegistry2;
     }
 
-
+    /**
+     * This is the job launching method outsiders of GFac can use, this will invoke the GFac
handler chain and providers
+     * And update the registry occordingly, so the users can query the database to retrieve
status and output from Registry
+     *
+     * @param experimentID
+     * @return
+     * @throws GFacException
+     */
     public boolean submitJob(String experimentID) throws GFacException {
-                  ConfigurationData configurationData = (ConfigurationData)registry.get(DataType.EXPERIMENT_CONFIGURATION_DATA,
experimentID);
+        ConfigurationData configurationData = (ConfigurationData) registry.get(DataType.EXPERIMENT_CONFIGURATION_DATA,
experimentID);
         String serviceName = configurationData.getApplicationId();
 
         if (serviceName == null) {
@@ -77,28 +97,20 @@ public class GFac {
             ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName);
 
             ApplicationDescription applicationDescription = airavataRegistry2.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?
-            //FIXME: gfac-config.xml is only under src/test.
             URL resource = GFac.class.getClassLoader().getResource("gfac-config.xml");
             Properties configurationProperties = ServerSettings.getProperties();
             GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),
airavataAPI, configurationProperties);
 
             JobExecutionContext jobExecutionContext = new JobExecutionContext(gFacConfiguration,
serviceName);
-            //Here we get only the contextheader information sent specific for this node
-            //Add security context
-
 
             ApplicationContext applicationContext = new ApplicationContext();
             applicationContext.setApplicationDeploymentDescription(applicationDescription);
             applicationContext.setHostDescription(hostDescription);
             applicationContext.setServiceDescription(serviceDescription);
-
             jobExecutionContext.setApplicationContext(applicationContext);
 
 
             Map<String, String> experimentInputs = configurationData.getExperimentInputs();
-
             jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getMessageContext(experimentInputs,
                     serviceDescription.getType().getInputParametersArray())));
 
@@ -107,11 +119,13 @@ public class GFac {
 
             jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID);
             jobExecutionContext.setExperimentID(experimentID);
-            //FIXME: (MEP) GFacAPI.submitJob() throws a GFacException that isn't caught here.
You want to catch this before updating the registry.
+
+
             GFacAPI gfacAPI1 = new GFacAPI();
             gfacAPI1.submitJob(jobExecutionContext);
-        }catch (Exception e){
-
+        } catch (Exception e) {
+            log.error("Error inovoking the job with experiment ID: " + experimentID);
+            throw new GFacException(e);
         }
         return true;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/6f604649/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
index 14fb95a..9ec0c43 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
@@ -2642,20 +2642,6 @@ public class AiravataJPARegistry extends AiravataRegistry2{
         return acceptedJobIds;
     }
 
-    /**
-     * TODO: Not fully implemented
-     * @param experimentID
-     * @return
-     * @throws RegistryException
-     */
-    public JobRequest fetchAcceptedJob(String experimentID) throws RegistryException {
-        GatewayResource gatewayResource = jpa.getGateway();
-        OrchestratorDataResource orchestratorResource = (OrchestratorDataResource)gatewayResource.get(ResourceType.ORCHESTRATOR,
experimentID);
-        JobRequest jobRequest = new JobRequest();
-        jobRequest.setUserName(orchestratorResource.getUserName());
-        jobRequest.setSystemExperimentID(orchestratorResource.getExperimentID());
-        return jobRequest;
-    }
 
     public List<String> getAllHangedJobs() throws RegistryException {
         List<Resource> hangedJobs = ResourceUtils.getOrchestratorDataWithStatus(AiravataJobState.State.UNKNOWN.toString());


Mime
View raw message