airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [4/7] git commit: Fixed workflow interpreter to work with multiple app
Date Thu, 09 Oct 2014 17:43:48 GMT
Fixed workflow interpreter to work with multiple app


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

Branch: refs/heads/master
Commit: a9a370d19b02499dc371baa5e95eb34a42fbb4c6
Parents: 896d345
Author: shamrath <shameerainfo@gmail.com>
Authored: Wed Oct 8 12:01:20 2014 -0400
Committer: shamrath <shameerainfo@gmail.com>
Committed: Wed Oct 8 12:01:20 2014 -0400

----------------------------------------------------------------------
 .../airavata/gfac/local/utils/InputUtils.java   |  7 +++
 .../engine/interpretor/WorkflowInterpreter.java | 27 ++++++-----
 .../WorkflowInterpreterLaunchWindow.java        | 48 +++++++++++---------
 .../airavata/xbaya/ui/menues/RunMenuItem.java   | 14 +++---
 4 files changed, 54 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/a9a370d1/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java
b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java
index ba65753..98671fd 100644
--- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java
+++ b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java
@@ -20,9 +20,15 @@
 */
 package org.apache.airavata.gfac.local.utils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.List;
 
 public class InputUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(InputUtils.class);
+
     private static final String SPACE = " ";
 
     private InputUtils() {
@@ -31,6 +37,7 @@ public class InputUtils {
     public static String buildCommand(List<String> cmdList) {
         StringBuffer buff = new StringBuffer();
         for (String string : cmdList) {
+            logger.debug("Build Command --> " + string);
             buff.append(string);
             buff.append(SPACE);
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/a9a370d1/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
index dd9c917..f9e26a6 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
@@ -40,7 +40,6 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.common.utils.StringUtil;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.common.utils.listener.AbstractActivityListener;
@@ -147,11 +146,13 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 
     private String credentialStoreToken;
     /**
-     *
+     * @param experiment
+     * @param credentialStoreToken
      * @param config
-     * @param interactor
+     * @param orchestratorClient
      */
-	public WorkflowInterpreter(Experiment experiment, String credentialStoreToken, WorkflowInterpreterConfiguration
config, OrchestratorService.Client orchestratorClient) {
+	public WorkflowInterpreter(Experiment experiment, String credentialStoreToken,
+                               WorkflowInterpreterConfiguration config, OrchestratorService.Client
orchestratorClient) {
 		this.setConfig(config);
 		this.setExperiment(experiment);
 		this.setCredentialStoreToken(credentialStoreToken);
@@ -204,9 +205,9 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 		try {
 			this.getWorkflow().setExecutionState(WorkflowExecutionState.RUNNING);
 			ArrayList<Node> inputNodes = this.getInputNodesDynamically();
-			List<DataObjectType> experimentOutputs = experiment.getExperimentInputs();
+			List<DataObjectType> experimentInputs = experiment.getExperimentInputs();
 			Map<String,String> inputDataStrings=new HashMap<String, String>();
-			for (DataObjectType dataObjectType : experimentOutputs) {
+			for (DataObjectType dataObjectType : experimentInputs) {
 				inputDataStrings.put(dataObjectType.getKey(), dataObjectType.getValue());
 			}
 			for (Node node : inputNodes) {
@@ -232,7 +233,7 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 				getRegistry().update(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNode, workflowNode.getNodeInstanceId());
 				updateWorkflowNodeStatus(workflowNode, WorkflowNodeState.COMPLETED);
 			}
-			
+
 			while (this.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
                 ArrayList<Node> readyNodes = this.getReadyNodesDynamically();
                 ArrayList<Thread> threadList = new ArrayList<Thread>();
@@ -364,9 +365,7 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 			// we reset all the state
 			cleanup();
         	raiseException(e);
-		} catch (AiravataAPIInvocationException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
-        }finally{
+		} finally{
         	cleanup();
 			this.getWorkflow().setExecutionState(WorkflowExecutionState.NONE);
 	    }
@@ -417,7 +416,7 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 		notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_CLEANUP, null);
 	}
 
-	private void sendOutputsDynamically() throws WorkflowException, AiravataAPIInvocationException,
RegistryException {
+	private void sendOutputsDynamically() throws WorkflowException, RegistryException {
 		ArrayList<Node> outputNodes = getReadyOutputNodesDynamically();
 		if (outputNodes.size() != 0) {
             LinkedList<Object> outputValues = new LinkedList<Object>();
@@ -633,6 +632,7 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 	
 	protected void handleWSComponent(Node node) throws WorkflowException, TException, RegistryException
{
         TaskDetails taskDetails = createTaskDetails(node);
+        log.debug("Launching task , node = " + node.getName() + " node id = " + node.getID());
         getOrchestratorClient().launchTask(taskDetails.getTaskID(), getCredentialStoreToken());
 	}
 	
@@ -998,7 +998,10 @@ public class WorkflowInterpreter implements AbstractActivityListener{
 				portInputValue = (String) ((InputNode) fromNode).getDefaultValue();			
 			} else if (fromNode instanceof WSNode){
 				Map<String, String> outputData = nodeOutputData.get(fromNode);
-				portInputValue = outputData.get(dataPort.getName());				
+                portInputValue = outputData.get(dataPort.getName());
+                if (portInputValue == null) {
+                    portInputValue = outputData.get(dataPort.getEdge(0).getFromPort().getName());
+                }
 			}
 			DataObjectType elem = new DataObjectType();
 			elem.setKey(dataPort.getName());

http://git-wip-us.apache.org/repos/asf/airavata/blob/a9a370d1/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
index fd6cb46..ac2b197 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/WorkflowInterpreterLaunchWindow.java
@@ -21,23 +21,6 @@
 
 package org.apache.airavata.xbaya.ui.experiment;
 
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.border.EtchedBorder;
-import javax.xml.namespace.QName;
-
 import org.apache.airavata.api.Airavata.Client;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.XMLUtil;
@@ -45,16 +28,15 @@ import org.apache.airavata.model.error.AiravataClientConnectException;
 import org.apache.airavata.model.error.AiravataClientException;
 import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.model.error.InvalidRequestException;
+import org.apache.airavata.model.util.ExperimentModelUtil;
 import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
 import org.apache.airavata.model.workspace.experiment.DataObjectType;
 import org.apache.airavata.model.workspace.experiment.DataType;
 import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
 import org.apache.airavata.orchestrator.client.OrchestratorClientFactory;
 import org.apache.airavata.orchestrator.cpi.OrchestratorService;
-import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreter;
-import org.apache.airavata.workflow.engine.interpretor.WorkflowInterpreterConfiguration;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
 import org.apache.airavata.workflow.model.graph.system.InputNode;
 import org.apache.airavata.workflow.model.graph.util.GraphUtil;
 import org.apache.airavata.workflow.model.wf.Workflow;
@@ -73,6 +55,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xmlpull.infoset.XmlElement;
 
+import javax.swing.*;
+import javax.swing.border.EtchedBorder;
+import javax.xml.namespace.QName;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
 public class WorkflowInterpreterLaunchWindow {
 
     private static final Logger logger = LoggerFactory.getLogger(WorkflowInterpreterLaunchWindow.class);
@@ -318,7 +311,18 @@ public class WorkflowInterpreterLaunchWindow {
             elem.setValue(value);
 			experiment.addToExperimentInputs(elem );
         }
-  
+
+        // Add scheduling configurations
+        String computeResouceId = airavataClient.getAllComputeResourceNames().get("localhost");
+
+        UserConfigurationData userConfigurationData = new UserConfigurationData();
+        ComputationalResourceScheduling computationalResourceScheduling = ExperimentModelUtil.createComputationResourceScheduling(
+                computeResouceId, 1, 1, 1, "normal", 1, 0, 1, "test");
+        userConfigurationData.setAiravataAutoSchedule(false);
+        userConfigurationData.setOverrideManualScheduledParams(false);
+        userConfigurationData.setComputationalResourceScheduling(computationalResourceScheduling);
+        experiment.setUserConfigurationData(userConfigurationData);
+
         experiment.setExperimentID(airavataClient.createExperiment(experiment));
         airavataClient.launchExperiment(experiment.getExperimentID(), "testToken");
 //        final String workflowInterpreterUrl = this.workflowInterpreterTextField.getText();

http://git-wip-us.apache.org/repos/asf/airavata/blob/a9a370d1/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
index 6cfde9f..fae974b 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RunMenuItem.java
@@ -45,8 +45,7 @@ import org.apache.airavata.xbaya.XBayaConfiguration.XBayaExecutionMode;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.core.ide.XBayaExecutionModeListener;
 import org.apache.airavata.xbaya.ui.dialogs.monitor.MonitorConfigurationWindow;
-import org.apache.airavata.xbaya.ui.experiment.LaunchApplicationWindow;
-//import org.apache.airavata.xbaya.ui.experiment.WorkflowInterpreterLaunchWindow;
+import org.apache.airavata.xbaya.ui.experiment.WorkflowInterpreterLaunchWindow;
 import org.apache.airavata.xbaya.ui.monitor.MonitorStarter;
 import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
 import org.apache.airavata.xbaya.ui.widgets.ToolbarButton;
@@ -268,8 +267,7 @@ public class RunMenuItem  implements EventListener, XBayaExecutionModeListener{
     private void createLaunchXBayaInterpreterItem() {
         this.launchXBayaInterpreterItem = new JMenuItem("Run on Interpreter Server...", MenuIcons.RUN_ICON);
         AbstractAction action = new AbstractAction() {
-        	//private WorkflowInterpreterLaunchWindow window;
-            private LaunchApplicationWindow window;
+        	private WorkflowInterpreterLaunchWindow window;
             public void actionPerformed(ActionEvent e) {
                 if(!engine.getMonitor().hasCurrentExecutionTerminatedNotificationReceived()
&& engine.getMonitor().isMonitoring()){
                     if (JOptionPane.showConfirmDialog(null,
@@ -278,10 +276,10 @@ public class RunMenuItem  implements EventListener, XBayaExecutionModeListener{
                         return;
                     }
                 }
-//                if (this.window == null) {
-                //this.window = new WorkflowInterpreterLaunchWindow(engine);
-                this.window = new LaunchApplicationWindow(engine);
-//                }
+
+                if (this.window == null) {
+                    this.window = new WorkflowInterpreterLaunchWindow(engine);
+                }
                 try {
                     this.window.show();
                 } catch (Exception e1) {


Mime
View raw message