airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1463339 - /airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
Date Tue, 02 Apr 2013 00:22:42 GMT
Author: heshan
Date: Tue Apr  2 00:22:41 2013
New Revision: 1463339

URL: http://svn.apache.org/r1463339
Log:
AIRAVATA-803 Fixing some issues when extracting the result from the remote shell. TODO: Have
a timeout just in case if the user forgets to properly configure the application descriptor.
In that case job should return with an error. 

Modified:
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java?rev=1463339&r1=1463338&r2=1463339&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
Tue Apr  2 00:22:41 2013
@@ -48,6 +48,7 @@ import org.apache.airavata.gfac.notifica
 import org.apache.airavata.gfac.provider.GFacProvider;
 import org.apache.airavata.gfac.provider.GFacProviderException;
 import org.apache.airavata.gfac.provider.utils.ProviderUtils;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.apache.airavata.schemas.gfac.Ec2ApplicationDeploymentType;
 import org.apache.airavata.schemas.gfac.OutputParameterType;
 import org.apache.airavata.schemas.gfac.StringParameterType;
@@ -72,8 +73,6 @@ public class EC2Provider implements GFac
 
     public static final int SSH_PORT = 22;
 
-    public static final String KEY_PAIR_NAME = "gfac";
-
     public static final String KEY_PAIR_FILE = "ec2_rsa";
 
     private static final String PRIVATE_KEY_FILE_PATH = System.getProperty("user.home") +
"/.ssh/" + KEY_PAIR_FILE;
@@ -184,7 +183,7 @@ public class EC2Provider implements GFac
             while((read = in.read(buffer)) > 0) {
                 String out = new String(buffer, 0, read);
 
-                if(out.startsWith("distance")) {
+                if(out.startsWith(outParamName)) {
                     executionResult = out.split("=")[1];
                     log.debug("Result found in the StandardOut ");
                     break;
@@ -214,6 +213,13 @@ public class EC2Provider implements GFac
 
     }
 
+    /**
+     * Creates the command to be executed in the remote shell.
+     *
+     * @param jobExecutionContext JobExecutionContext for the cloud job
+     * @return shell command to be executed
+     * @throws GFacProviderException GFacProviderException
+     */
     private String createShellCmd(JobExecutionContext jobExecutionContext) throws GFacProviderException
{
         String command = "";
         ApplicationDescription appDesc = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
@@ -239,9 +245,28 @@ public class EC2Provider implements GFac
             }
 
             log.info("Command to be executed on EC2 : " + command);
+
+        } else {
+            ApplicationDeploymentDescriptionType type = appDesc.getType();
+
+            command = "sh" + " " + type.getExecutableLocation();
+
+            List<String> inputParams = null;
+            try {
+                inputParams = ProviderUtils.getInputParameters(jobExecutionContext);
+            } catch (GFacProviderException e) {
+                throw new GFacProviderException("Error in extracting input values from JobExecutionContext");
+            }
+
+            for(String param : inputParams){
+                command = " " + command + " " + param;
+            }
+
+            log.info("Command to be executed on EC2 : " + command);
+
         }
 
-        return command;
+        return command + '\n';
     }
 
     public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException
{



Mime
View raw message