MATLAB PARALLEL COMPUTING TOOLBOX - S Uživatelská příručka Strana 167

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 656
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 166
Apply Callbacks to MJS Jobs and Tasks
6-27
Create and save a callback function clientTaskCompleted.m on the path of the
MATLAB client, with the following content. (If you created this function for the previous
example, you can use that.)
function clientTaskCompleted(task,eventdata)
disp(['Finished task: ' num2str(task.ID)])
Create objects for the cluster, job, and task. Then submit the job. All the callback
properties are set from the profile when the objects are created.
c = parcluster('MyMJS');
j = createJob(c,'Name','Job_52a');
createTask(j,@rand,1,{2,4});
submit(j)
Job_52a now queued
Job_52a now running
Finished task: 1
Job_52a now finished
Tips
You should avoid running code in your callback functions that might cause conflicts.
For example, if every task in a job has a callback that plots its results, there is no
Zobrazit stránku 166
1 2 ... 162 163 164 165 166 167 168 169 170 171 172 ... 655 656

Komentáře k této Příručce

Žádné komentáře