diff m-toolbox/classes/@LTPDAworkbench/runPipeline.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@LTPDAworkbench/runPipeline.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,57 @@
+% RUNPIPELINE runs the currently active pipeline from the beginning.
+%
+% CALL: wb.runPipeline
+%
+% M Hewitson 13-11-08
+%
+% $Id: runPipeline.m,v 1.21 2011/03/29 13:40:16 hewitson Exp $
+%
+function varargout = runPipeline(varargin)
+  
+  wb = varargin{1};
+  if ~isa(wb, 'LTPDAworkbench')
+    error('runPipeline needs an LTPDAworkbench instance as the first input.');
+  end
+  
+  % Assume running is successful
+  res = true;
+  
+  setappdata(0, 'LTPDAworkbench', wb);
+  wb.reset(false);
+  
+  wb.mp.setExecuting(true);
+  if wb.mp.popupConsoleOnExecution()
+    wb.mp.showConsole();
+  end
+  
+  try
+    
+    LTPDAworkbench.executeConstants(wb);
+    
+    % Now execute all other blocks
+    cmds = {};
+    while awtinvoke(wb.mp, 'countReadyBlocks') > 0
+      try
+        wb.stepForward;
+      catch exception
+        utils.helper.errorDlg([exception.message], 'Execution error');
+        wb.addErrorMessage(exception.cause{1}.message);
+        utils.helper.err(exception.message);
+        res = false;
+      end
+      drawnow;
+    end
+  catch
+    wb.mp.setExecuting(false);
+    res = false;
+  end
+  wb.mp.setExecuting(false);
+  
+  setappdata(0, 'LTPDAworkbench', []);
+  
+  if nargout == 1
+    varargout{1} = res;
+  end
+  
+end
+