You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2011/12/19 21:57:47 UTC

svn commit: r1220943 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: graph/system/ForEachNode.java interpretor/WorkflowInterpreter.java menues/run/RunMenuItem.java

Author: lahiru
Date: Mon Dec 19 20:57:46 2011
New Revision: 1220943

URL: http://svn.apache.org/viewvc?rev=1220943&view=rev
Log:
fixing an issue when try to run workflow again and again.

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/ForEachNode.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/run/RunMenuItem.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/ForEachNode.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/ForEachNode.java?rev=1220943&r1=1220942&r2=1220943&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/ForEachNode.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/system/ForEachNode.java Mon Dec 19 20:57:46 2011
@@ -38,11 +38,12 @@ import org.apache.airavata.xbaya.graph.G
 import org.apache.airavata.xbaya.graph.GraphSchema;
 import org.apache.airavata.xbaya.graph.Port;
 import org.apache.airavata.xbaya.graph.Port.Kind;
+import org.apache.airavata.xbaya.graph.dynamic.PortAddable;
 import org.apache.airavata.xbaya.graph.gui.NodeGUI;
 import org.apache.airavata.xbaya.graph.system.gui.ForEachNodeGUI;
 import org.xmlpull.infoset.XmlElement;
 
-public class ForEachNode extends SystemNode {
+public class ForEachNode extends SystemNode implements PortAddable{
 
     // private static final MLogger logger = MLogger.getLogger();
 

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java?rev=1220943&r1=1220942&r2=1220943&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/interpretor/WorkflowInterpreter.java Mon Dec 19 20:57:46 2011
@@ -164,11 +164,6 @@ public class WorkflowInterpreter {
 
     private boolean isoffline = false;
 
-	// public WorkflowInterpreter(XBayaConfiguration configuration, String
-	// topic,
-	// Workflow workflow, String username, String password) {
-	// this(configuration, topic, workflow, username, password, false);
-	// }
 
 	/**
 	 * 
@@ -388,11 +383,13 @@ public class WorkflowInterpreter {
 			} else {
 				finish();
 			}
+            this.workflow.setExecutionState(XBayaExecutionState.NONE);
 		} catch (RuntimeException e) {
 			// we reset all the state
 			cleanup();
-			raiseException(e);
-		}
+            this.workflow.setExecutionState(XBayaExecutionState.NONE);
+            raiseException(e);
+        }
 	}
 
 	/**

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/run/RunMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/run/RunMenuItem.java?rev=1220943&r1=1220942&r2=1220943&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/run/RunMenuItem.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/menues/run/RunMenuItem.java Mon Dec 19 20:57:46 2011
@@ -35,6 +35,8 @@ import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
 
 import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.XBayaException;
+import org.apache.airavata.xbaya.XBayaRuntimeException;
 import org.apache.airavata.xbaya.event.Event;
 import org.apache.airavata.xbaya.event.Event.Type;
 import org.apache.airavata.xbaya.event.EventListener;
@@ -44,6 +46,7 @@ import org.apache.airavata.xbaya.gridche
 import org.apache.airavata.xbaya.gui.ErrorMessages;
 import org.apache.airavata.xbaya.gui.ToolbarButton;
 import org.apache.airavata.xbaya.gui.XBayaToolBar;
+import org.apache.airavata.xbaya.interpretor.XBayaExecutionState;
 import org.apache.airavata.xbaya.jython.gui.JythonRunnerWindow;
 import org.apache.airavata.xbaya.menues.MenuIcons;
 import org.apache.airavata.xbaya.monitor.Monitor;
@@ -51,6 +54,7 @@ import org.apache.airavata.xbaya.monitor
 import org.apache.airavata.xbaya.monitor.MonitorException;
 import org.apache.airavata.xbaya.monitor.gui.MonitorConfigurationWindow;
 import org.apache.airavata.xbaya.monitor.gui.MonitorStarter;
+import org.apache.airavata.xbaya.wf.Workflow;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -298,11 +302,25 @@ public class RunMenuItem  implements Eve
             	if (isWorkflowRunning()){
             		if (JOptionPane.showConfirmDialog(null, "A previous workflow excution data needs to be cleared before launching another workflow. Do you wish to continue?", "Run Dynamic Workflow", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
             			cleanup();
-            		}else{
+                    }else{
             			return;
             		}
             	}
                 if (this.window == null) {
+                    int count = 0;
+                    //there is a possibility the ealier run is not yet cleanedup yet.. so wait until it finishes
+                    // and sets the execution state to NONE as the last task of scheduleDynamically
+                    while(engine.getWorkflow().getExecutionState() != XBayaExecutionState.NONE){
+                        try {
+                            Thread.sleep(500);
+                        } catch (InterruptedException e) {
+                            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                        }
+                        count++;
+                        if(count > 20){
+                            throw new XBayaRuntimeException("Error stopping previous workflow Execution");
+                        }
+                    }
                     this.window = new DynamicWorkflowRunnerWindow(engine);
                 }
                 this.window.show();