Products & Services Industries Academia Support User Community Company

Learn more about Parallel Computing Toolbox   

wait - Wait for job to finish or change state

Syntax

wait(obj)
wait(obj, 'state')
wait(obj, 'state', timeout)

Arguments

obj

Job object whose change in state to wait for.

'state'

Value of the job object's State property to wait for.

timeout

Maximum time to wait, in seconds.

Description

wait(obj) blocks execution in the client session until the job identified by the object obj reaches the 'finished' state or fails. This occurs when all the job's tasks are finished processing on remote workers.

wait(obj, 'state') blocks execution in the client session until the specified job object changes state to the value of 'state'. The valid states to wait for are 'queued', 'running', and 'finished'.

If the object is currently or has already been in the specified state, a wait is not performed and execution returns immediately. For example, if you execute wait(job, 'queued') for a job already in the 'finished' state, the call returns immediately.

wait(obj, 'state', timeout) blocks execution until either the job reaches the specified 'state', or timeout seconds elapse, whichever happens first.

Examples

Submit a job to the queue, and wait for it to finish running before retrieving its results.

submit(job);
wait(job, 'finished')
results = getAllOutputArguments(job)

Submit a batch job and wait for it to finish before retrieving its variables.

job = batch('myScript');
wait(job)
load(job)

See Also

pause, resume, waitForState

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS