Documentation

取消

Cancel job or task

Syntax

取消(t)
取消(j)

Arguments

t

Pending or running task to cancel.

j

等待、运行或queued job to cancel.

Description

取消(t)stops the task object,t, that is currently in the pending or running state. The task’sStateproperty is set tofinished, and no output arguments are returned. An error message stating that the task was canceled is placed in the task object'sErrorMessageproperty, and the worker session running the task is restarted.

取消(j)stops the job object,j, that is pending, queued, or running. The job’sStateproperty is set tofinished, and a cancel is executed on all tasks in the job that are not in thefinishedstate. A job object that has been canceled cannot be started again.

If the job is running from an MJS, any worker sessions that are evaluating tasks belonging to the job object are restarted.

If the specified job or task is already in thefinishedstate, no action is taken.

Examples

Cancel a task. Note afterward the task’sState,ErrorIdentifier, andErrorMessageproperties.

c = parcluster(); job1 = createJob(c); t = createTask(job1, @rand, 1, {3,3}); cancel(t) t
Task with properties: ID: 1 State: finished Function: @rand Parent: Job 1 StartTime: Running Duration: 0 days 0h 0m 0s ErrorIdentifier: parallel:task:UserCancellation ErrorMessage: The task was cancelled by user "mylogin" on machine "myhost.mydomain.com".

See Also

|

Introduced before R2006a

Was this topic helpful?