No BSD License  

Highlights from
DistributePP

from DistributePP by Dr. Michael D. DeVore
A distributed parallel processing toolbox.

PP_GET_STATUS(PR_REQUESTS)
function [RT_COMPLETE,varargout] = PP_GET_STATUS(PR_REQUESTS)
% [RT_COMPLETE,RT_SERVER,RT_TIME] = PP_GET_STATUS(PR_REQUESTS)
%
%   This function checks to see which of the Parallel Processing
%   requests have completed and returns a logical vector RT_COMPLETE
%   with a 1 for each element of the cell array PR_REQUESTS that
%   is finished processing. If requested, a cell array RT_SERVER will
%   be populated with the name of the PP server to handle each request
%   (if the request has been picked up) and RT_TIME will have the date
%   and time when the request was picked up.
%
%   Parameters:
%      PR_REQUESTS - a cell array of PP requests or, optionally,
%         a single request or matrix with a request in each row.

% This file and the DistributePP software package were created and
% are maintained by Michael D. DeVore. The package originated in
% November, 1999. Permission is granted by the author for anyone
% to use or modify this software provided that:
% (1) any modified files are documented internally to clearly indicate
%     that they have been modified from the original release; and
% (2) it is recognized that neigher Michael D. DeVore nor Washington
%     University assumes any liability for the use or misuse of the software.

LV_GET_SERVERS = (nargout > 1);
LV_GET_TIMES   = (nargout > 2);

if ~iscell(PR_REQUESTS)
   PR_REQUESTS = cellstr(PR_REQUESTS);
end

RT_COMPLETE = (zeros(size(PR_REQUESTS)) > 1);

if LV_GET_SERVERS
   LV_SERVERS = cell(size(PR_REQUESTS));
end

if LV_GET_TIMES
   LV_TIMES = cell(size(PR_REQUESTS));
end
   
for LV_COUNT = 1:prod(size(PR_REQUESTS))
   RT_COMPLETE(LV_COUNT) = (exist([PR_REQUESTS{LV_COUNT} '.req'],'file') == 0);
   
   if LV_GET_SERVERS
      if exist([PR_REQUESTS{LV_COUNT} '.prc'],'file')
         LV_FID = fopen([PR_REQUESTS{LV_COUNT} '.prc'],'r');
         while ~feof(LV_FID)
            LV_LAST_REC = fgetl(LV_FID);
         end
         fclose(LV_FID);
         
         [LV_SERVERS{LV_COUNT},LV_LAST_REC] = strtok(LV_LAST_REC,',');
      else
         LV_SERVERS{LV_COUNT} = '';
         LV_LAST_REC = '';
      end
   end
   
   if LV_GET_TIMES
      LV_TIMES{LV_COUNT} = strrep(LV_LAST_REC,', ','');
   end
end

if LV_GET_SERVERS
   varargout(1) = {LV_SERVERS};
end

if LV_GET_TIMES
   varargout(2) = {LV_TIMES};
end

Contact us at files@mathworks.com