<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/251680</link>
    <title>MATLAB Central Newsreader - waitForState</title>
    <description>Feed for thread: waitForState</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 19 May 2009 06:40:18 -0400</pubDate>
      <title>waitForState</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/251680#650828</link>
      <author>Mr. CFD</author>
      <description>Hi,&lt;br&gt;
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?&lt;br&gt;
====================================================&lt;br&gt;
n=5;&lt;br&gt;
clusterHost = 'xxx.xxx.xxx;&lt;br&gt;
remoteDataLocation = '/matlab/';&lt;br&gt;
&lt;br&gt;
% Create a job scheduler / manager object:&lt;br&gt;
timeLimit = '00:04:00'; &lt;br&gt;
sched = findResource('scheduler', 'type', 'generic');&lt;br&gt;
&lt;br&gt;
% Use a local directory as the DataLocation&lt;br&gt;
set(sched, 'DataLocation', 'C:\MATLAB')&lt;br&gt;
&lt;br&gt;
set(sched, 'ClusterMatlabRoot', '/matlab/R2008b');&lt;br&gt;
set(sched, 'HasSharedFilesystem', true)&lt;br&gt;
set(sched, 'ClusterOsType', 'unix');&lt;br&gt;
set(sched, 'GetJobStateFcn', @pbsGetJobState);&lt;br&gt;
set(sched, 'DestroyJobFcn', @pbsDestroyJob);&lt;br&gt;
&lt;br&gt;
% For parallel job:&lt;br&gt;
set(sched, 'ParallelSubmitFcn', {@pbsNonSharedParallelSubmitFcn, timeLimit, clusterHost, remoteDataLocation});&lt;br&gt;
pjob = createMatlabPoolJob(sched)&lt;br&gt;
&lt;br&gt;
set(pjob, 'FileDependencies', {my_func.m'})&lt;br&gt;
&lt;br&gt;
% Create and submit the task, wait for results&lt;br&gt;
createTask(pjob, @my_func, 1, {n});                                    &lt;br&gt;
set(pjob,'MinimumNumberOfWorkers',1);&lt;br&gt;
set(pjob,'MaximumNumberOfWorkers',1);&lt;br&gt;
&lt;br&gt;
submit(pjob)&lt;br&gt;
waitForState(pjob, 'finished');&lt;br&gt;
&lt;br&gt;
results = getAllOutputArguments(pjob)&lt;br&gt;
% celldisp(results);&lt;br&gt;
&lt;br&gt;
% Convert to matrices   &lt;br&gt;
% result1=results{1,1};&lt;br&gt;
&lt;br&gt;
% Close job   &lt;br&gt;
destroy(pjob);   </description>
    </item>
  </channel>
</rss>

