airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [45/53] [abbrv] airavata git commit: Handled URI_COLLECTION input data type
Date Thu, 07 Jul 2016 19:30:31 GMT
Handled URI_COLLECTION input data type


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

Branch: refs/heads/master
Commit: b9b43b6bf21155ad4098e346cedb78848f6032ef
Parents: 5645031
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Tue Jul 5 12:19:14 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Tue Jul 5 12:19:14 2016 -0400

----------------------------------------------------------------------
 .../org/apache/airavata/gfac/core/GFacConstants.java |  2 +-
 .../org/apache/airavata/gfac/core/GFacUtils.java     | 14 ++++++++++++++
 .../apache/airavata/gfac/impl/GFacEngineImpl.java    | 15 +++++++++++++--
 .../cpi/impl/SimpleOrchestratorImpl.java             |  1 +
 4 files changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b9b43b6b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacConstants.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacConstants.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacConstants.java
index 444956b..6b7531a 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacConstants.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacConstants.java
@@ -50,7 +50,7 @@ public class GFacConstants {
 	public static final String _127_0_0_1 = "127.0.0.1";
 	public static final String LOCALHOST = "localhost";
 
-
+	public static final String MULTIPLE_INPUTS_SPLITTER = ",";
 
 	public static final String PROP_WORKFLOW_INSTANCE_ID = "workflow.instance.id";
 	public static final String PROP_WORKFLOW_NODE_ID = "workflow.node.id";

http://git-wip-us.apache.org/repos/asf/airavata/blob/b9b43b6b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
index 799ea28..17d9b15 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
@@ -491,6 +491,20 @@ public class GFacUtils {
                         String filePath = inputDataObjectType.getValue();
                         filePath = filePath.substring(filePath.lastIndexOf(File.separatorChar)
+ 1, filePath.length());
                         inputValues.add(filePath);
+                    } else if (inputDataObjectType.getType() == DataType.URI_COLLECTION)
{
+                        String filePaths = inputDataObjectType.getValue();
+                        String[] paths = filePaths.split(GFacConstants.MULTIPLE_INPUTS_SPLITTER);
+                        String filePath;
+                        String inputs = "";
+                        int i = 0;
+                        for (; i < paths.length - 1; i++) {
+                            filePath = paths[i];
+                            filePath = filePath.substring(filePath.lastIndexOf(File.separatorChar)
+ 1, filePath.length());
+                            // File names separate by a space
+                            inputs += filePath + " ";
+                        }
+                        inputs += paths[i];
+                        inputValues.add(inputs);
                     } else {
                         inputValues.add(inputDataObjectType.getValue());
                     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/b9b43b6b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
index c0e2526..3fb95e0 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngineImpl.java
@@ -26,6 +26,7 @@ import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.ThriftUtils;
 import org.apache.airavata.common.utils.ZkConstants;
+import org.apache.airavata.gfac.core.GFacConstants;
 import org.apache.airavata.gfac.core.GFacEngine;
 import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.GFacUtils;
@@ -535,12 +536,22 @@ public class GFacEngineImpl implements GFacEngine {
         GFacUtils.saveAndPublishTaskStatus(taskContext);
 
         ProcessContext processContext = taskContext.getParentProcessContext();
+        // handle URI_COLLECTION input data type
         Task dMoveTask = Factory.getDataMovementTask(processContext.getDataMovementProtocol());
-        taskStatus = executeTask(taskContext, dMoveTask, false);
+        if (taskContext.getProcessInput().getType() == DataType.URI_COLLECTION) {
+            String values = taskContext.getProcessInput().getValue();
+            String[] multiple_inputs = values.split(GFacConstants.MULTIPLE_INPUTS_SPLITTER);
+            for (String input : multiple_inputs) {
+                taskContext.getProcessInput().setValue(input);
+                taskStatus = executeTask(taskContext, dMoveTask, false);
+            }
+            taskContext.getProcessInput().setValue(values);
+        } else {
+            taskStatus = executeTask(taskContext, dMoveTask, false);
+        }
         taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
         taskContext.setTaskStatus(taskStatus);
         GFacUtils.saveAndPublishTaskStatus(taskContext);
-
         checkFailures(taskContext, taskStatus, dMoveTask);
         return false;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/b9b43b6b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index 4489ef0..3e057cb 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -377,6 +377,7 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{
                     case STDOUT:
                         break;
                     case URI:
+                    case URI_COLLECTION:
                         try {
                             TaskModel inputDataStagingTask = getInputDataStagingTask(processModel,
processInput, gatewayId);
                             String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK,
inputDataStagingTask,


Mime
View raw message