airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [40/44] git commit: adding EC2 provider changes
Date Wed, 05 Nov 2014 18:30:28 GMT
adding EC2 provider changes


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

Branch: refs/heads/gfac_appcatalog_int
Commit: d856d246e2651c5034bc6c125a14551a01bdf40c
Parents: 3e584f8
Author: chathuriw <kamalasini@gmail.com>
Authored: Wed Nov 5 10:14:50 2014 -0500
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Wed Nov 5 13:10:24 2014 -0500

----------------------------------------------------------------------
 .../airavata/gfac/core/utils/GFacUtils.java     |  15 +-
 .../apache/airavata/gfac/ec2/EC2Provider.java   |  46 ++-
 .../airavata/gfac/ec2/EC2ProviderTest.java      | 366 ++++++++++---------
 3 files changed, 232 insertions(+), 195 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/d856d246/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
index b38808b..6fb2115 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/utils/GFacUtils.java
@@ -39,10 +39,7 @@ import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
 import org.apache.airavata.gfac.core.states.GfacExperimentState;
 import org.apache.airavata.gfac.core.states.GfacPluginState;
-import org.apache.airavata.model.appcatalog.computeresource.GlobusJobSubmission;
-import org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission;
-import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission;
-import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission;
+import org.apache.airavata.model.appcatalog.computeresource.*;
 import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.model.workspace.experiment.DataType;
 import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
@@ -1289,5 +1286,15 @@ public class GFacUtils {
         }
     }
 
+    public static CloudJobSubmission getCloudJobSubmission (String submissionId) throws AppCatalogException{
+        try {
+            AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
+            return appCatalog.getComputeResource().getCloudJobSubmission(submissionId);
+        }catch (Exception e){
+            String errorMsg = "Error while retrieving SSH job submission with submission
id : " + submissionId;
+            log.error(errorMsg, e);
+            throw new AppCatalogException(errorMsg, e);
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/d856d246/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
index 5c5af53..53e0f93 100644
--- a/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
+++ b/modules/gfac/gfac-ec2/src/main/java/org/apache/airavata/gfac/ec2/EC2Provider.java
@@ -28,6 +28,7 @@ import java.util.Calendar;
 import java.util.List;
 import java.util.Map;
 
+import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
 import org.apache.airavata.gfac.GFacException;
@@ -39,6 +40,10 @@ import org.apache.airavata.gfac.core.utils.GFacUtils;
 import org.apache.airavata.gfac.ec2.util.AmazonEC2Util;
 import org.apache.airavata.gfac.ec2.util.EC2ProviderUtil;
 import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
+import org.apache.airavata.model.appcatalog.computeresource.CloudJobSubmission;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.computeresource.ProviderName;
 import org.apache.airavata.model.workspace.experiment.JobState;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.apache.airavata.schemas.gfac.Ec2ApplicationDeploymentType;
@@ -221,9 +226,8 @@ public class EC2Provider extends AbstractProvider {
                 /* Assuming that there is just a single result. If you want to add more results,
update the necessary
                    logic below */
                 String paramName = outparamType.getName();
-                outParam.getType().changeType(StringParameterType.type);
-                ((StringParameterType) outParam.getType()).setValue(executionResult);
-                jobExecutionContext.getOutMessageContext().addParameter(paramName, outParam);
+                String value = outparamType.getValue();
+                jobExecutionContext.getOutMessageContext().addParameter(paramName, value);
             }
             GFacUtils.saveJobStatus(jobExecutionContext, details, JobState.COMPLETE);
         } catch (InvalidSshKeyException e) {
@@ -252,26 +256,28 @@ public class EC2Provider extends AbstractProvider {
      * @throws GFacProviderException GFacProviderException
      */
     private String createShellCmd(JobExecutionContext jobExecutionContext) throws GFacProviderException
{
-        String command = "";
-        ApplicationDescription appDesc = jobExecutionContext.getApplicationContext().
-                getApplicationDeploymentDescription();
-
-        if(appDesc.getType() instanceof Ec2ApplicationDeploymentType) {
-            Ec2ApplicationDeploymentType type = (Ec2ApplicationDeploymentType) appDesc.getType();
-            if(type.getExecutable() != null) {
-                command = type.getExecutableType() + " " + type.getExecutable();
+        try {
+            String command = "";
+            JobSubmissionInterface submissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
+            CloudJobSubmission cloudJobSubmission = GFacUtils.getCloudJobSubmission(submissionInterface.getJobSubmissionInterfaceId());
+            String executablePath = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getExecutablePath();
+            if (cloudJobSubmission.getProviderName().equals(ProviderName.EC2)) {
+                if (cloudJobSubmission.getExecutableType() != null) {
+                    command = cloudJobSubmission.getExecutableType() + " " + executablePath;
+                } else {
+                    command = "sh" + " " + executablePath;
+                }
+                command = setCmdParams(jobExecutionContext, command);
+
             } else {
-                command = "sh" + " " + type.getExecutable();
+                command = "sh" + " " + executablePath;
+                command = setCmdParams(jobExecutionContext, command);
             }
-            command = setCmdParams(jobExecutionContext, command);
-
-        } else {
-            ApplicationDeploymentDescriptionType type = appDesc.getType();
-            command = "sh" + " " + type.getExecutableLocation();
-            command = setCmdParams(jobExecutionContext, command);
+            return command + '\n';
+        } catch (AppCatalogException e) {
+            log.error("Error while retrieving cloud job submission", e);
+            throw new GFacProviderException("Error while retrieving cloud job submission",
e);
         }
-
-        return command + '\n';
     }
 
     private String setCmdParams(JobExecutionContext jobExecutionContext, String command)
throws GFacProviderException {

http://git-wip-us.apache.org/repos/asf/airavata/blob/d856d246/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
b/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
index d558ab9..9f86197 100644
--- a/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
+++ b/modules/gfac/gfac-ec2/src/test/java/org/apache/airavata/gfac/ec2/EC2ProviderTest.java
@@ -1,171 +1,195 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.airavata.gfac.ec2;
-
-import org.apache.airavata.commons.gfac.type.*;
-import org.apache.airavata.gfac.GFacConfiguration;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.core.context.ApplicationContext;
-import org.apache.airavata.gfac.core.context.JobExecutionContext;
-import org.apache.airavata.gfac.core.context.MessageContext;
-import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
-import org.apache.airavata.schemas.gfac.*;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Your Amazon instance should be in a running state before running this test.
- */
-public class EC2ProviderTest {
-    private JobExecutionContext jobExecutionContext;
-
-    private static final String hostName = "ec2-host";
-
-    private static final String hostAddress = "ec2-address";
-
-    private static final String sequence1 = "RR042383.21413#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA"
+
-            "CTCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCCTGCGCCCATTGACCAATATTCCTCA"
+
-            "CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC"
+
-            "CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAATCTTCCTTTCAGAAG"
+
-            "GCTGTCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCCGCCGGTCGCCATCAGTCTTAGCAAGCTAAGACCATGCTGCCCCTGACTTGCATGT"
+
-            "GTTAAGCCTGTAGCTTAGCGTTC";
-
-    private static final String sequence2 = "RR042383.31934#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA"
+
-            "CCCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCTCTCGCCCATTGACCAATATTCCTCA"
+
-            "CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC"
+
-            "CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAAATCTTCCTTTCAGAA"
+
-            "GGCTATCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCG";
-
-    /* Following variables are needed to be set in-order to run the test. Since these are
account specific information,
-       I'm not adding the values here. It's the responsibility of the person who's running
the test to update
-       these variables accordingly.
-       */
-
-    /* Username used to log into your ec2 instance eg.ec2-user */
-    private String userName = "";
-
-    /* Secret key used to connect to the image */
-    private String secretKey = "";
-
-    /* Access key used to connect to the image */
-    private String accessKey = "";
-
-    /* Instance id of the running instance of your image */
-    private String instanceId = "";
-
-    @Before
-    public void setUp() throws Exception {
-        URL resource = EC2ProviderTest.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
-        assert resource != null;
-        System.out.println(resource.getFile());
-        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),
null);
-
-        /* EC2 Host */
-        HostDescription host = new HostDescription(Ec2HostType.type);
-        host.getType().setHostName(hostName);
-        host.getType().setHostAddress(hostAddress);
-
-        /* App */
-        ApplicationDescription ec2Desc = new ApplicationDescription(Ec2ApplicationDeploymentType.type);
-        Ec2ApplicationDeploymentType ec2App = (Ec2ApplicationDeploymentType)ec2Desc.getType();
-
-        String serviceName = "Gnome_distance_calculation_workflow";
-        ec2Desc.getType().addNewApplicationName().setStringValue(serviceName);
-        ec2App.setJobType(JobTypeType.EC_2);
-        ec2App.setExecutable("/home/ec2-user/run.sh");
-        ec2App.setExecutableType("sh");
-
-        /* Service */
-        ServiceDescription serv = new ServiceDescription();
-        serv.getType().setName("GenomeEC2");
-
-        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
-
-        InputParameterType input1 = InputParameterType.Factory.newInstance();
-        input1.setParameterName("genome_input1");
-        input1.setParameterType(StringParameterType.Factory.newInstance());
-        inputList.add(input1);
-
-        InputParameterType input2 = InputParameterType.Factory.newInstance();
-        input2.setParameterName("genome_input2");
-        input2.setParameterType(StringParameterType.Factory.newInstance());
-        inputList.add(input2);
-
-        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
-
-        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
-        OutputParameterType output = OutputParameterType.Factory.newInstance();
-        output.setParameterName("genome_output");
-        output.setParameterType(StringParameterType.Factory.newInstance());
-        outputList.add(output);
-
-        OutputParameterType[] outputParamList = outputList
-                .toArray(new OutputParameterType[outputList.size()]);
-
-        serv.getType().setInputParametersArray(inputParamList);
-        serv.getType().setOutputParametersArray(outputParamList);
-
-        jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
-        ApplicationContext applicationContext = new ApplicationContext();
-        jobExecutionContext.setApplicationContext(applicationContext);
-        applicationContext.setServiceDescription(serv);
-        applicationContext.setApplicationDeploymentDescription(ec2Desc);
-        applicationContext.setHostDescription(host);
-
-        AmazonSecurityContext amazonSecurityContext =
-                new AmazonSecurityContext(userName, accessKey, secretKey, instanceId);
-        jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
amazonSecurityContext);
-
-        MessageContext inMessage = new MessageContext();
-        ActualParameter genomeInput1 = new ActualParameter();
-        ((StringParameterType)genomeInput1.getType()).setValue(sequence1);
-        inMessage.addParameter("genome_input1", genomeInput1);
-
-        ActualParameter genomeInput2 = new ActualParameter();
-        ((StringParameterType)genomeInput2.getType()).setValue(sequence2);
-        inMessage.addParameter("genome_input2", genomeInput2);
-
-        MessageContext outMessage = new MessageContext();
-        ActualParameter echo_out = new ActualParameter();
-        outMessage.addParameter("distance", echo_out);
-
-        jobExecutionContext.setInMessageContext(inMessage);
-        jobExecutionContext.setOutMessageContext(outMessage);
-    }
-
-    @Test
-    public void testGramProvider() throws GFacException {
-        BetterGfacImpl gFacAPI = new BetterGfacImpl();
-        gFacAPI.submitJob(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(),
jobExecutionContext.getGatewayID());
-        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
-        Assert.assertEquals(MappingFactory.
-                toString((ActualParameter) outMessageContext.getParameter("genome_output")),
"476");
-    }
-}
-
-
+///*
+// *
+// * 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.
+// *
+// */
+//
+//package org.apache.airavata.gfac.ec2;
+//
+//import org.airavata.appcatalog.cpi.AppCatalog;
+//import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+//import org.apache.airavata.commons.gfac.type.*;
+//import org.apache.airavata.gfac.GFacConfiguration;
+//import org.apache.airavata.gfac.GFacException;
+//import org.apache.airavata.gfac.core.context.ApplicationContext;
+//import org.apache.airavata.gfac.core.context.JobExecutionContext;
+//import org.apache.airavata.gfac.core.context.MessageContext;
+//import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
+//import org.apache.airavata.model.appcatalog.computeresource.*;
+//import org.apache.airavata.schemas.gfac.*;
+//import org.junit.Assert;
+//import org.junit.Before;
+//import org.junit.Test;
+//
+//import java.io.File;
+//import java.net.URL;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * Your Amazon instance should be in a running state before running this test.
+// */
+//public class EC2ProviderTest {
+//    private JobExecutionContext jobExecutionContext;
+//
+//    private static final String hostName = "ec2-host";
+//
+//    private static final String hostAddress = "ec2-address";
+//
+//    private static final String sequence1 = "RR042383.21413#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA"
+
+//            "CTCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCCTGCGCCCATTGACCAATATTCCTCA"
+
+//            "CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC"
+
+//            "CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAATCTTCCTTTCAGAAG"
+
+//            "GCTGTCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCCGCCGGTCGCCATCAGTCTTAGCAAGCTAAGACCATGCTGCCCCTGACTTGCATGT"
+
+//            "GTTAAGCCTGTAGCTTAGCGTTC";
+//
+//    private static final String sequence2 = "RR042383.31934#CTGGCACGGAGTTAGCCGATCCTTATTCATAAAGTACATGCAAACGGGTATCCATA"
+
+//            "CCCGACTTTATTCCTTTATAAAAGAAGTTTACAACCCATAGGGCAGTCATCCTTCACGCTACTTGGCTGGTTCAGGCTCTCGCCCATTGACCAATATTCCTCA"
+
+//            "CTGCTGCCTCCCGTAGGAGTTTGGACCGTGTCTCAGTTCCAATGTGGGGGACCTTCCTCTCAGAACCCCTATCCATCGAAGACTAGGTGGGCCGTTACCCCGC"
+
+//            "CTACTATCTAATGGAACGCATCCCCATCGTCTACCGGAATACCTTTAATCATGTGAACATGCGGACTCATGATGCCATCTTGTATTAAATCTTCCTTTCAGAA"
+
+//            "GGCTATCCAAGAGTAGACGGCAGGTTGGATACGTGTTACTCACCGTGCG";
+//
+//    /* Following variables are needed to be set in-order to run the test. Since these are
account specific information,
+//       I'm not adding the values here. It's the responsibility of the person who's running
the test to update
+//       these variables accordingly.
+//       */
+//
+//    /* Username used to log into your ec2 instance eg.ec2-user */
+//    private String userName = "";
+//
+//    /* Secret key used to connect to the image */
+//    private String secretKey = "";
+//
+//    /* Access key used to connect to the image */
+//    private String accessKey = "";
+//
+//    /* Instance id of the running instance of your image */
+//    private String instanceId = "";
+//
+//    @Before
+//    public void setUp() throws Exception {
+//        URL resource = EC2ProviderTest.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML);
+//        assert resource != null;
+//        System.out.println(resource.getFile());
+//        GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),
null);
+//
+//        /* EC2 Host */
+//        ComputeResourceDescription host = new ComputeResourceDescription();
+//        host.setHostName(hostName);
+//        host.setResourceDescription("EC2 compute resource");
+//        host.addToIpAddresses(hostAddress);
+//
+//        CloudJobSubmission cloudJobSubmission = new CloudJobSubmission();
+//        cloudJobSubmission.setProviderName(ProviderName.EC2);
+//        cloudJobSubmission.setExecutableType("sh");
+//        cloudJobSubmission.setNodeId(instanceId);
+//        cloudJobSubmission.setSecurityProtocol(SecurityProtocol.USERNAME_PASSWORD);
+//        cloudJobSubmission.setUserAccountName(userName);
+//
+//        AppCatalog appCatalog = AppCatalogFactory.getAppCatalog();
+//        String submissionId = appCatalog.getComputeResource().addCloudJobSubmission(cloudJobSubmission);
+//
+//        JobSubmissionInterface submissionInterface = new JobSubmissionInterface();
+//        submissionInterface.setJobSubmissionInterfaceId(submissionId);
+//        submissionInterface.setJobSubmissionProtocol(JobSubmissionProtocol.CLOUD);
+//        submissionInterface.setPriorityOrder(0);
+//
+//        host.addToJobSubmissionInterfaces(submissionInterface);
+//
+//        String computeResourceId = appCatalog.getComputeResource().addComputeResource(host);
+//
+//        /* App */
+//
+//        ApplicationDescription ec2Desc = new ApplicationDescription(Ec2ApplicationDeploymentType.type);
+//        Ec2ApplicationDeploymentType ec2App = (Ec2ApplicationDeploymentType)ec2Desc.getType();
+//
+//        String serviceName = "Gnome_distance_calculation_workflow";
+//        ec2Desc.getType().addNewApplicationName().setStringValue(serviceName);
+//        ec2App.setJobType(JobTypeType.EC_2);
+//        ec2App.setExecutable("/home/ec2-user/run.sh");
+//        ec2App.setExecutableType("sh");
+//
+//        /* Service */
+//        ServiceDescription serv = new ServiceDescription();
+//        serv.getType().setName("GenomeEC2");
+//
+//        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+//
+//        InputParameterType input1 = InputParameterType.Factory.newInstance();
+//        input1.setParameterName("genome_input1");
+//        input1.setParameterType(StringParameterType.Factory.newInstance());
+//        inputList.add(input1);
+//
+//        InputParameterType input2 = InputParameterType.Factory.newInstance();
+//        input2.setParameterName("genome_input2");
+//        input2.setParameterType(StringParameterType.Factory.newInstance());
+//        inputList.add(input2);
+//
+//        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
+//
+//        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
+//        OutputParameterType output = OutputParameterType.Factory.newInstance();
+//        output.setParameterName("genome_output");
+//        output.setParameterType(StringParameterType.Factory.newInstance());
+//        outputList.add(output);
+//
+//        OutputParameterType[] outputParamList = outputList
+//                .toArray(new OutputParameterType[outputList.size()]);
+//
+//        serv.getType().setInputParametersArray(inputParamList);
+//        serv.getType().setOutputParametersArray(outputParamList);
+//
+//        jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+//        ApplicationContext applicationContext = new ApplicationContext();
+//        jobExecutionContext.setApplicationContext(applicationContext);
+//        applicationContext.setServiceDescription(serv);
+//        applicationContext.setApplicationDeploymentDescription(ec2Desc);
+//        applicationContext.setHostDescription(host);
+//
+//        AmazonSecurityContext amazonSecurityContext =
+//                new AmazonSecurityContext(userName, accessKey, secretKey, instanceId);
+//        jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
amazonSecurityContext);
+//
+//        MessageContext inMessage = new MessageContext();
+//        ActualParameter genomeInput1 = new ActualParameter();
+//        ((StringParameterType)genomeInput1.getType()).setValue(sequence1);
+//        inMessage.addParameter("genome_input1", genomeInput1);
+//
+//        ActualParameter genomeInput2 = new ActualParameter();
+//        ((StringParameterType)genomeInput2.getType()).setValue(sequence2);
+//        inMessage.addParameter("genome_input2", genomeInput2);
+//
+//        MessageContext outMessage = new MessageContext();
+//        ActualParameter echo_out = new ActualParameter();
+//        outMessage.addParameter("distance", echo_out);
+//
+//        jobExecutionContext.setInMessageContext(inMessage);
+//        jobExecutionContext.setOutMessageContext(outMessage);
+//    }
+//
+//    @Test
+//    public void testGramProvider() throws GFacException {
+//        BetterGfacImpl gFacAPI = new BetterGfacImpl();
+//        gFacAPI.submitJob(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID(),
jobExecutionContext.getGatewayID());
+//        MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
+//        Assert.assertEquals(MappingFactory.
+//                toString((ActualParameter) outMessageContext.getParameter("genome_output")),
"476");
+//    }
+//}
+//
+//


Mime
View raw message