Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: waitForState
Date: Tue, 19 May 2009 06:40:18 +0000 (UTC)
Organization: RMIT
Lines: 42
Message-ID: <gutk8i$l6o$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1242715218 21720 172.30.248.37 (19 May 2009 06:40:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 19 May 2009 06:40:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1372013
Xref: news.mathworks.com comp.soft-sys.matlab:540904


Hi,
When running a job on a cluster, I have noticed that the 'waitForState' command does not perform as expected. When a function is submitted on a cluster, the simulations progress successfully and all the files/results are generated and saved as expected. However, MATLAB continues to display a 'busy' status, even though the tasks on the cluster have successfully completed. Strangely, rebooting MATLAB and running the task again works (i.e. MATLAB correctly outputs the solutions when the cluster is finished), however over time, the 'waitForState' command again fails. Can you please suggest what is happening?
====================================================
n=5;
clusterHost = 'xxx.xxx.xxx;
remoteDataLocation = '/matlab/';

% Create a job scheduler / manager object:
timeLimit = '00:04:00'; 
sched = findResource('scheduler', 'type', 'generic');

% Use a local directory as the DataLocation
set(sched, 'DataLocation', 'C:\MATLAB')

set(sched, 'ClusterMatlabRoot', '/matlab/R2008b');
set(sched, 'HasSharedFilesystem', true)
set(sched, 'ClusterOsType', 'unix');
set(sched, 'GetJobStateFcn', @pbsGetJobState);
set(sched, 'DestroyJobFcn', @pbsDestroyJob);

% For parallel job:
set(sched, 'ParallelSubmitFcn', {@pbsNonSharedParallelSubmitFcn, timeLimit, clusterHost, remoteDataLocation});
pjob = createMatlabPoolJob(sched)

set(pjob, 'FileDependencies', {my_func.m'})

% Create and submit the task, wait for results
createTask(pjob, @my_func, 1, {n});                                    
set(pjob,'MinimumNumberOfWorkers',1);
set(pjob,'MaximumNumberOfWorkers',1);

submit(pjob)
waitForState(pjob, 'finished');

results = getAllOutputArguments(pjob)
% celldisp(results);

% Convert to matrices   
% result1=results{1,1};

% Close job   
destroy(pjob);