airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject svn commit: r1350658 - in /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac: notification/ notification/impl/ provider/impl/ provider/utils/
Date Fri, 15 Jun 2012 15:36:46 GMT
Author: raminder
Date: Fri Jun 15 15:36:46 2012
New Revision: 1350658

URL: http://svn.apache.org/viewvc?rev=1350658&view=rev
Log:
commit to fix for-each in case of outputs are produced in output folder. AIRAVATA-444 

Modified:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/Subject.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/DefaultNotifier.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/LoggingNotification.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/StandardOutNotification.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/WorkflowTrackingNotification.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/Subject.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/Subject.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/Subject.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/Subject.java
Fri Jun 15 15:36:46 2012
@@ -41,7 +41,7 @@ public interface Subject {
      */
     void input(InvocationContext context, String... data);
 
-    void output(Object notifier, InvocationContext context, String... data);
+    void output(InvocationContext context, String... data);
 
     /*
      * 

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/DefaultNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/DefaultNotifier.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/DefaultNotifier.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/DefaultNotifier.java
Fri Jun 15 15:36:46 2012
@@ -79,10 +79,10 @@ public class DefaultNotifier implements 
         }
     }
 
-    public void output(Object notifier, InvocationContext context, String... data) {
+    public void output(InvocationContext context, String... data) {
         for (GFacNotifiable notif : notifiableObjects) {
             try {
-                notif.output(notifier, context, data);
+                notif.output(context, data);
             } catch (Exception e) {
                 logger.error(e.getMessage(), e);
             }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/LoggingNotification.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/LoggingNotification.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/LoggingNotification.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/LoggingNotification.java
Fri Jun 15 15:36:46 2012
@@ -45,7 +45,8 @@ public class LoggingNotification impleme
         printOut(context, data);
     }
 
-    public void output(Object notifier, InvocationContext context, String... data) {
+    public void output(InvocationContext context, String... data) {
+    	 printOut(context, data);
     }
 
     public void startExecution(InvocationContext context) {

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/StandardOutNotification.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/StandardOutNotification.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/StandardOutNotification.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/StandardOutNotification.java
Fri Jun 15 15:36:46 2012
@@ -40,7 +40,8 @@ public class StandardOutNotification imp
         printOut(context, data);
     }
 
-    public void output(Object notifier, InvocationContext context, String... data) {
+    public void output(InvocationContext context, String... data) {
+    	 printOut(context, data);
     }
 
     public void startExecution(InvocationContext context) {

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/WorkflowTrackingNotification.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/WorkflowTrackingNotification.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/WorkflowTrackingNotification.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/notification/impl/WorkflowTrackingNotification.java
Fri Jun 15 15:36:46 2012
@@ -89,7 +89,7 @@ public class WorkflowTrackingNotificatio
     public void input(InvocationContext context, String... data) {
     }
 
-    public void output(Object notifier, InvocationContext context, String... data) {
+    public void output(InvocationContext context, String... data) {
     }
 
     public void startExecution(InvocationContext context) {

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
Fri Jun 15 15:36:46 2012
@@ -261,7 +261,6 @@ public class GramProvider extends Abstra
             if (hostgridFTP == null || hostgridFTP.length == 0) {
                 hostgridFTP = new String[] { host.getHostAddress() };
             }
-            boolean success = false;
             ProviderException pe = new ProviderException("");
             for (String endpoint : host.getGridFTPEndPointArray()) {
                 try {
@@ -298,6 +297,7 @@ public class GramProvider extends Abstra
 							((URIArrayType) actualParameter.getType()).setValueArray(valueList);
 							stringMap = new HashMap<String, ActualParameter>();
 							stringMap.put(paramName, actualParameter);
+							invocationContext.getExecutionContext().getNotifier().output(invocationContext, actualParameter.toString());
 						}
                     	else{
                     	// This is to handle exception during the output parsing.
@@ -343,6 +343,9 @@ public class GramProvider extends Abstra
                 } catch (URISyntaxException e) {
                     invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,readLastLinesofStdOut(localStdErrFile.getPath(),
20));
                     throw new ProviderException("URI is malformatted:" + e.getMessage(),
e);
+                }catch (NullPointerException e) {
+                    invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,e.getMessage());
+                    throw new ProviderException("Outupt is not produced in stdout:" + e.getMessage(),
e);
                 }
             }
 
@@ -361,7 +364,7 @@ public class GramProvider extends Abstra
 	@Override
 	protected Map<String, ?> processInput(InvocationContext invocationContext)
             throws ProviderException {
-        MessageContext inputNew = new ParameterContextImpl();
+        MessageContext<ActualParameter> inputNew = new ParameterContextImpl();
         try {
 		MessageContext<Object> input = invocationContext.getInput();
         for (Iterator<String> iterator = input.getNames(); iterator.hasNext();) {
@@ -427,7 +430,7 @@ public class GramProvider extends Abstra
     }
 
     private void stageOutputFiles(InvocationContext invocationContext,String outputFileStagingPath)
throws ProviderException {
-        MessageContext outputNew = new ParameterContextImpl();
+        MessageContext<ActualParameter> outputNew = new ParameterContextImpl();
         MessageContext<Object> input = invocationContext.getOutput();
         for (Iterator<String> iterator = input.getNames(); iterator.hasNext(); ) {
             String paramName = iterator.next();

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java?rev=1350658&r1=1350657&r2=1350658&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
Fri Jun 15 15:36:46 2012
@@ -27,11 +27,14 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
+import org.apache.airavata.core.gfac.context.message.MessageContext;
 import org.apache.airavata.core.gfac.exception.ToolsException;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.apache.airavata.schemas.gfac.GramApplicationDeploymentType;
 import org.apache.airavata.schemas.gfac.NameValuePairType;
+import org.apache.airavata.schemas.gfac.URIArrayType;
 import org.apache.airavata.schemas.wec.ContextHeaderDocument;
 import org.globus.gram.GramAttributes;
 import org.slf4j.Logger;
@@ -91,13 +94,22 @@ public class GramRSLGenerator {
 
         if (app.getStandardInput() != null && !"".equals(app.getStandardInput()))
{
             jobAttr.setStdin(app.getStandardInput());
-        } else {
-            // input parameter
-            for (Iterator<String> iterator = context.getInput().getNames(); iterator.hasNext();)
{
-                String key = iterator.next();
-                jobAttr.addArgument(context.getInput().getStringValue(key));
-            }
-        }
+		} else {
+			MessageContext<Object> input = context.getInput();
+			for (Iterator<String> iterator = input.getNames(); iterator.hasNext();) {
+				String paramName = iterator.next();
+				ActualParameter actualParameter = (ActualParameter) input.getValue(paramName);
+				if ("URIArray".equals(actualParameter.getType().getType().toString())) {
+					String[] values = ((URIArrayType) actualParameter.getType()).getValueArray();
+					for (String value : values) {
+						jobAttr.addArgument(value);
+					}
+				} else {
+					String paramValue = input.getStringValue(paramName);
+					jobAttr.addArgument(paramValue);
+				}
+			}
+		}
         // Using the workflowContext Header values if user provided them in the request and
overwrite the default values in DD
         ContextHeaderDocument.ContextHeader currentContextHeader = WorkflowContextHeaderBuilder.getCurrentContextHeader();
         if (currentContextHeader != null &&



Mime
View raw message