diff m-toolbox/classes/@LTPDAworkbench/cb_executePlan.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/cb_executePlan.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,56 @@
+% cb_executePlan execute the execution plan
+%
+% M Hewitson 27-05-09
+%
+% $Id: cb_executePlan.m,v 1.4 2011/03/30 07:59:30 hewitson Exp $
+%
+function cb_executePlan(varargin)
+  
+  disp('*** executing plan...');
+  
+  wb = varargin{1};
+  
+  % Get all selected blocks
+  execPlan = awtinvoke(wb.mp, 'getExecPlan');
+  steps = execPlan.getSteps();
+  
+  wb.mp.setExecuting(true);
+  
+  try
+    % Go through each step
+    for kk=1:steps.size
+      % Get the execution step
+      step = steps.get(kk-1);
+      if step.isActive
+        % Get diagram
+        bd = step.getDiag;
+        disp('===================================');
+        disp(['== Executing ' char(bd.getName) ]);
+        disp('===================================');
+        % set to active diagram
+        bd.setVisible(true);
+        bd.setSelected(true);
+        % run this diagram
+        res = wb.runPipeline;
+        if ~res
+          bname = questdlg(sprintf('Execution of pipeline "%s" failed. Do you want to continue?', char(bd.getName)), ...
+            'Pipeline Execution Failure', ...
+            'Continue', 'Abort', 'Abort');
+          
+          switch lower(bname)
+            case 'continue'
+            case 'abort'
+              break;
+          end
+          
+        end
+      end
+    end
+    
+  catch
+    wb.mp.setExecuting(false);
+  end
+  
+  wb.mp.setExecuting(false);
+  
+end