Main Content

cancelAll

Cancel all jobs or tasks

    Description

    example

    cancelAll(p.FevalQueue) stops all queued or running elements of the specified pool.

    Examples

    collapse all

    Create a parallel pool.

    pool = parpool;
    Starting parallel pool (parpool) using the 'Processes' profile ...
    Connected to the parallel pool (number of workers: 6).
    

    Use parfeval to run pause(Inf) without retrieving any outputs.

    f = parfeval(pool,@pause,0,Inf);

    Check the status of functions queued and running in the pool.

    pool.FevalQueue
    ans = 
     FevalQueue with properties: 
    
            QueuedFutures: [0x0 parallel.FevalFuture]
           RunningFutures: [1x1 parallel.FevalFuture]
    
    

    Use cancelAll to stop all Futures in FevalQueue.

    cancelAll(pool.FevalQueue)
    pool.FevalQueue
    ans = 
     FevalQueue with properties: 
    
            QueuedFutures: [0x0 parallel.FevalFuture]
           RunningFutures: [0x0 parallel.FevalFuture]
    
    

    Input Arguments

    collapse all

    Queue of FevalFuture objects to run on the background pool, specified as an FevalFuture scalar and FevalFuture array.

    Version History

    Introduced in R2022a

    See Also

    | |