view m-toolbox/classes/@LTPDAworkbench/cb_submitObjects.m @ 38:3aef676a1b20 database-connection-manager

Keep backtrace on error
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents a26669b59d7e
children
line wrap: on
line source

% CB_SUBMITOBJECTS submits the selected blocks outputs to a repository
%
% CALL: LTPDAworkbench.cb_submitObjects
%
% M Hewitson 13-11-08
%
% $Id: cb_submitObjects.m,v 1.9 2010/08/06 19:10:49 ingo Exp $
%
function cb_submitObjects(varargin)
  
  wb = varargin{1};
  
  wb
  
  % Get all selected blocks
  sbs = awtinvoke(wb.mp, 'getSelectedBlocks');
  
  outvars = {};
  for ii=0:sbs.size()-1
    block = sbs.get(ii);
    
    % if this is a MElementWithPorts
    if isa(block, 'mpipeline.canvas.MElementWithPorts')
      
      % loop over all outputs
      outports = block.getOutputs();
      for kk=0:outports.size()-1
        op = outports.get(kk);
        % get variable name
        outvar = LTPDAworkbench.getWS_VarName(wb.UUID, block, op.getNumber);
        outvars = [outvars {outvar}];
      end
    end
  end
  
  jsinfo = wb.mp.getSubmissionInfo();
  
  sinfo.experiment_title = char(jsinfo.getExperimentTitle);
  sinfo.experiment_description = char(jsinfo.getExperimentDescription);
  sinfo.analysis_description = char(jsinfo.getAnalysisDescription);
  sinfo.quantity = char(jsinfo.getQuantity);
  sinfo.keywords = char(jsinfo.getKeywords);
  sinfo.reference_ids = char(jsinfo.getReferenceIDs);
  sinfo.additional_comments = char(jsinfo.getAdditionalComments);
  sinfo.additional_authors = char(jsinfo.getAdditionalAuthors);
  
  cmd = '[ids, cids] = submit(';
  
  for kk=1:numel(outvars)
    cmd = [cmd outvars{kk} ','];
  end
  
  cmd = [cmd 'sinfo, plist(''hostname'', ''''));'];

  disp(sinfo)
  disp(cmd)
  
  assignin('base', 'sinfo', sinfo);
  try
    evalin('base', cmd);
  catch me
    fprintf(2, [me.message '\n']);
    utils.helper.errorDlg('Unable to submit selected object. Has the pipeline been executed?', 'Submission error');
  end
  
end