cancelAll - Cancel all jobs or tasks - MATLAB (original) (raw)

Main Content

Cancel all jobs or tasks

Since R2022a

Syntax

Description

cancelAll([p.FevalQueue](#mw%5F6f31beea-78c5-43e8-88ef-5f3a14efe164)) stops all queued or running elements of the specified pool.

example

Examples

collapse all

Create a parallel pool.

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.

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.

Extended Capabilities

Version History

Introduced in R2022a