airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject git commit: Application Interface Examples - AIRAVATA-1344
Date Fri, 11 Jul 2014 13:17:39 GMT
Repository: airavata
Updated Branches:
  refs/heads/master b6392ef33 -> 3e151ce37


Application Interface Examples -  AIRAVATA-1344


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

Branch: refs/heads/master
Commit: 3e151ce37690a1664b2a18747153ef12466e82ec
Parents: b6392ef
Author: Suresh Marru <smarru@apache.org>
Authored: Fri Jul 11 09:17:32 2014 -0400
Committer: Suresh Marru <smarru@apache.org>
Committed: Fri Jul 11 09:17:32 2014 -0400

----------------------------------------------------------------------
 .../tools/RegisterSampleApplications.java       | 153 +++++++++++++++----
 .../tools/RegisterSampleApplicationsUtils.java  |  26 +++-
 2 files changed, 148 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3e151ce3/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
index 9db25fb..f6de61d 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
@@ -38,6 +38,8 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
 import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
 import org.apache.airavata.model.appcatalog.computeresource.*;
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
@@ -64,6 +66,28 @@ public class RegisterSampleApplications {
     private static String trestlesResourceId;
     private static String bigredResourceId;
 
+    //Appplication Names
+    private static final String echoName = "Echo";
+    private static final String amberName = "Amber";
+    private static final String autoDockName = "AutoDock";
+    private static final String espressoName = "ESPRESSO";
+    private static final String gromacsName = "GROMACS";
+    private static final String lammpsName = "LAMMPS";
+    private static final String nwChemName = "NWChem";
+    private static final String trinityName = "Trinity";
+    private static final String wrfName = "WRF";
+
+    //Appplication Descriptions
+    private static final String echoDescription = "A Simple Echo Application";
+    private static final String amberDescription = "Amber Molecular Dynamics Package";
+    private static final String autoDockDescription = "AutoDock suite of automated docking
tools";
+    private static final String espressoDescription = "Nanoscale electronic-structure calculations
and materials modeling";
+    private static final String gromacsDescription = "GROMACS Molecular Dynamics Package";
+    private static final String lammpsDescription = "Large-scale Atomic/Molecular Massively
Parallel Simulator";
+    private static final String nwChemDescription = "Ab initio computational chemistry software
package";
+    private static final String trinityDescription = "de novo reconstruction of transcriptomes
from RNA-seq data";
+    private static final String wrfDescription = "Weather Research and Forecasting";
+
     //App Module Id's
     private static String echoModuleId;
     private static String amberModuleId;
@@ -75,6 +99,17 @@ public class RegisterSampleApplications {
     private static String trinityModuleId;
     private static String wrfModuleId;
 
+    //App Interface Id's
+    private static String echoInterfaceId;
+    private static String amberInterfaceId;
+    private static String autoDockInterfaceId;
+    private static String espressoInterfaceId;
+    private static String gromacsInterfaceId;
+    private static String lammpsInterfaceId;
+    private static String nwChemInterfaceId;
+    private static String trinityInterfaceId;
+    private static String wrfInterfaceId;
+
     public static void main(String[] args) {
         try {
             airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST,
THRIFT_SERVER_PORT);
@@ -89,6 +124,9 @@ public class RegisterSampleApplications {
             //Register all application deployments
             registerAppDeployments();
 
+            //Register all application interfaces
+            registerAppInterfaces();
+
         } catch (Exception e) {
             logger.error("Error while connecting with server", e.getMessage());
             e.printStackTrace();
@@ -127,55 +165,55 @@ public class RegisterSampleApplications {
             //Register Echo
             echoModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "Echo", "1.0", "A Simple Echo Application"));
+                            echoName, "1.0", echoDescription));
             System.out.println("Echo Module Id " + echoModuleId);
 
             //Register Amber
             amberModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "Amber", "12.0", "Amber Molecular Dynamics Package"));
+                            amberName, "12.0", amberDescription));
             System.out.println("Amber Module Id " + amberModuleId);
 
             //Register AutoDock
             autoDockModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "AutoDock", "4.2", "AutoDock suite of automated docking tools"));
+                            autoDockName, "4.2", autoDockDescription));
             System.out.println("AutoDock Module Id " + autoDockModuleId);
 
             //Register ESPRESSO
             espressoModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "ESPRESSO", "5.0.3", "Nanoscale electronic-structure calculations
and materials modeling"));
+                            espressoName, "5.0.3", espressoDescription));
             System.out.println("ESPRESSO Module Id " + espressoModuleId);
 
             //Register GROMACS
             gromacsModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "GROMACS", "4.6.5", "GROMACS Molecular Dynamics Package"));
+                            gromacsName, "4.6.5", gromacsDescription));
             System.out.println("GROMACS Module Id " + gromacsModuleId);
 
             //Register LAMMPS
             lammpsModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "LAMMPS", "20Mar14", "Large-scale Atomic/Molecular Massively
Parallel Simulator"));
+                            lammpsName, "20Mar14", lammpsDescription));
             System.out.println("LAMMPS Module Id " + lammpsModuleId);
 
             //Register NWChem
             nwChemModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "NWChem", "6.3", "Ab initio computational chemistry software
package"));
+                            nwChemName, "6.3", nwChemDescription));
             System.out.println("NWChem Module Id " + nwChemModuleId);
 
             //Register Trinity
             trinityModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "Trinity", "r20130225", "de novo reconstruction of transcriptomes
from RNA-seq data"));
+                            trinityName, "r20130225", trinityDescription));
             System.out.println("Trinity Module Id " + trinityModuleId);
 
             //Register WRF
             wrfModuleId = airavataClient.registerApplicationModule(
                     RegisterSampleApplicationsUtils.createApplicationModule(
-                            "WRF", "3.5.1", "Weather Research and Forecasting"));
+                            wrfName, "3.5.1", wrfDescription));
             System.out.println("WRF Module Id " + wrfModuleId);
 
         } catch (TException e) {
@@ -197,63 +235,124 @@ public class RegisterSampleApplications {
         registerBigRedApps();
     }
 
-    public static void registerStampedeApps() {
+    public static void registerAppInterfaces() {
+        System.out.println("\n #### Registering Application Interfaces #### \n");
+
+        //Registering Echo
+        registerEchoInterface();
+
+        //Registering Amber
+//        registerAmberInterface();
+
+        //Registering AutoDock
+//        registerAutoDockInterface();
+
+        //Registering Espresso
+//        registerEspressoInterface();
+
+        //Registering Gromacs
+//        registerGromacsInterface();
+
+        //Registering Lammps
+//        registerLammpsInterface();
+
+        //Registering NWChem
+//        registerNWChemInterface();
+
+        //Registering Trinity
+//        registerTrinityInterface();
+
+        //Registering WRF
+//        registerWRFInterface();
+
+    }
+
+    public static void registerEchoInterface() {
+        try {
+            System.out.println("#### Registering Echo Interface #### \n");
+
+            List<String> echoModules = new ArrayList<String>();
+            echoModules.add(echoModuleId);
+
+            InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("Input_to_Echo",
"Hello World",
+                    DataType.STRING, null, false, null, null);
+
+            List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>();
+            applicationInputs.add(input1);
+
+            OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output",
+                    "", DataType.STRING);
+
+            List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
+            applicationOutputs.add(output1);
+
+            echoInterfaceId = airavataClient.registerApplicationInterface(
+                    RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(echoName,echoDescription,
+                            echoModules,applicationInputs,applicationOutputs));
+            System.out.println("Echo Application Interface Id " + echoInterfaceId);
+
+        } catch (TException e) {
+            e.printStackTrace();
+        }
+    }
+
+        public static void registerStampedeApps() {
         try {
             System.out.println("#### Registering Application Deployments on Stampede ####
\n");
 
             //Register Echo
             String echoAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId,
stampedeResourceId,
-                            "/bin/echo", ApplicationParallelismType.SERIAL, "Echo Testing
Application"));
+                            "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription));
             System.out.println("Echo on stampede deployment Id " + echoAppDeployId);
 
             //Register Amber
             String amberAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(amberModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/amber_wrapper_simple.sh",
ApplicationParallelismType.MPI,
-                            "Amber Molecular Dynamics Package"));
+                            amberDescription));
             System.out.println("Amber on stampede deployment Id " + amberAppDeployId);
 
             //Register ESPRESSO
             String espressoAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(espressoModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/espresso_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "Nanoscale electronic-structure calculations and materials modeling"));
+                            espressoDescription));
             System.out.println("ESPRESSO on stampede deployment Id " + espressoAppDeployId);
 
             //Register GROMACS
             String gromacsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(gromacsModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/gromacs_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "GROMACS Molecular Dynamics Package"));
+                            gromacsDescription));
             System.out.println("GROMACS on stampede deployment Id " + gromacsAppDeployId);
 
             //Register LAMMPS
             String lammpsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(lammpsModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/lammps_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "Large-scale Atomic/Molecular Massively Parallel Simulator"));
+                            lammpsDescription));
             System.out.println("LAMMPS on stampede deployment Id " + lammpsAppDeployId);
 
             //Register NWChem
             String nwChemAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(nwChemModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/nwchem_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "Ab initio computational chemistry software package"));
+                            nwChemDescription));
             System.out.println("NWChem on stampede deployment Id " + nwChemAppDeployId);
 
             //Register Trinity
             String trinityAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(trinityModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/trinity_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "de novo reconstruction of transcriptomes from RNA-seq data"));
+                            trinityDescription));
             System.out.println("Trinity on stampede deployment Id " + trinityAppDeployId);
 
             //Register WRF
             String wrfAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(wrfModuleId,
stampedeResourceId,
                             "/home1/01437/ogce/production/app_wrappers/wrf_wrapper_3.5.1.sh",
ApplicationParallelismType.MPI,
-                            "Weather Research and Forecasting"));
+                            wrfDescription));
             System.out.println("WRF on stampede deployment Id " + wrfAppDeployId);
 
         } catch (TException e) {
@@ -268,28 +367,28 @@ public class RegisterSampleApplications {
             //Register Echo
             String echoAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId,
trestlesResourceId,
-                            "/bin/echo", ApplicationParallelismType.SERIAL, "Echo Testing
Application"));
+                            "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription));
             System.out.println("Echo on trestles deployment Id " + echoAppDeployId);
 
             //Register Amber
             String amberAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(amberModuleId,
trestlesResourceId,
                             "/home/ogce/production/app_wrappers/amber_wrapper_simple.sh",
ApplicationParallelismType.MPI,
-                            "Amber Molecular Dynamics Package"));
+                            amberDescription));
             System.out.println("Amber on trestles deployment Id " + amberAppDeployId);
 
             //Register GROMACS
             String gromacsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(gromacsModuleId,
trestlesResourceId,
                             "/home/ogce/production/app_wrappers/gromacs_wrapper.sh", ApplicationParallelismType.MPI,
-                            "GROMACS Molecular Dynamics Package"));
+                            gromacsDescription));
             System.out.println("GROMACS on trestles deployment Id " + gromacsAppDeployId);
 
             //Register LAMMPS
             String lammpsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(lammpsModuleId,
trestlesResourceId,
                             "/home/ogce/production/app_wrappers/lammps_wrapper.sh", ApplicationParallelismType.MPI,
-                            "Large-scale Atomic/Molecular Massively Parallel Simulator"));
+                            lammpsDescription));
             System.out.println("LAMMPS on trestles deployment Id " + lammpsAppDeployId);
 
         } catch (TException e) {
@@ -304,35 +403,35 @@ public class RegisterSampleApplications {
             //Register Echo
             String echoAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId,
bigredResourceId,
-                            "/bin/echo", ApplicationParallelismType.SERIAL, "Echo Testing
Application"));
+                            "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription));
             System.out.println("Echo on bigredII deployment Id " + echoAppDeployId);
 
             //Register Amber
             String amberAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(amberModuleId,
bigredResourceId,
                             "/N/u/cgateway/BigRed2/production/app_wrappers/amber_wrapper_simple.sh",
ApplicationParallelismType.MPI,
-                            "Amber Molecular Dynamics Package"));
+                            amberDescription));
             System.out.println("Amber on bigredII deployment Id " + amberAppDeployId);
 
             //Register AutoDock
             String autoDockDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(nwChemModuleId,
bigredResourceId,
                             "/N/u/cgateway/BigRed2/production/app_wrappers/auto_dock_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "AutoDock suite of automated docking tools"));
+                            autoDockDescription));
             System.out.println("AutoDock on bigredII deployment Id " + autoDockDeployId);
 
             //Register GROMACS
             String gromacsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(gromacsModuleId,
bigredResourceId,
                             "/N/u/cgateway/BigRed2/production/app_wrappers/gromacs_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "GROMACS Molecular Dynamics Package"));
+                            gromacsDescription));
             System.out.println("GROMACS on bigredII deployment Id " + gromacsAppDeployId);
 
             //Register LAMMPS
             String lammpsAppDeployId = airavataClient.registerApplicationDeployment(
                     RegisterSampleApplicationsUtils.createApplicationDeployment(lammpsModuleId,
bigredResourceId,
                             "/N/u/cgateway/BigRed2/production/app_wrappers/lammps_wrapper.sh",
ApplicationParallelismType.MPI,
-                            "Large-scale Atomic/Molecular Massively Parallel Simulator"));
+                            lammpsDescription));
             System.out.println("LAMMPS on bigredII deployment Id " + lammpsAppDeployId);
 
         } catch (TException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e151ce3/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplicationsUtils.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplicationsUtils.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplicationsUtils.java
index f47b0aa..b0f6759 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplicationsUtils.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplicationsUtils.java
@@ -25,11 +25,13 @@ import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
 import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
 import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
 import org.apache.airavata.model.appcatalog.computeresource.*;
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -115,7 +117,9 @@ public class RegisterSampleApplicationsUtils {
         return resourceJobManager;
     }
 
-    public static InputDataObjectType createAppInput(String inputName, String argumentName,
String description, String value, org.apache.airavata.model.appcatalog.appinterface.DataType
type) {
+    public static InputDataObjectType createAppInput
+            (String inputName, String value, org.apache.airavata.model.appcatalog.appinterface.DataType
type,
+             String applicationArgument, boolean stdIn, String description, String metadata)
{
         InputDataObjectType input = new InputDataObjectType();
 //        input.setIsEmpty(false);
         if (inputName != null) {
@@ -127,8 +131,8 @@ public class RegisterSampleApplicationsUtils {
         if (type != null) {
             input.setType(type);
         }
-        if (argumentName != null) {
-            input.setApplicationArgument(argumentName);
+        if (applicationArgument != null) {
+            input.setApplicationArgument(applicationArgument);
         }
         if (description != null) {
             input.setUserFriendlyDescription(description);
@@ -151,4 +155,18 @@ public class RegisterSampleApplicationsUtils {
         return outputDataObjectType;
     }
 
-}
+    public static ApplicationInterfaceDescription createApplicationInterfaceDescription
+            (String applicationName, String applicationDesription, List<String> applicationModules,
+            List<InputDataObjectType> applicationInputs, List<OutputDataObjectType>applicationOutputs)
{
+        ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();
+
+        applicationInterfaceDescription.setApplicationName(applicationName);
+        if (applicationDesription != null) applicationInterfaceDescription.setApplicationDesription(applicationDesription);
+        if (applicationModules != null) applicationInterfaceDescription.setApplicationModules(applicationModules);
+        if (applicationInputs != null) applicationInterfaceDescription.setApplicationInputs(applicationInputs);
+        if (applicationOutputs != null) applicationInterfaceDescription.setApplicationOutputs(applicationOutputs);
+
+        return applicationInterfaceDescription;
+    }
+
+}
\ No newline at end of file


Mime
View raw message