ISchedulerJob::CancelTask_2 method

Cancels the specified task and provides the specified message to the user to explain why the task was canceled.

Syntax

HRESULT CancelTask_2(
  [in] ITaskId *TaskId,
  [in] BSTR    Message
);

Parameters

  • TaskId [in]
    A ITaskId interface for the task that you want to cancel.

  • Message [in]
    A string that specifies the message that you want to provide to the user to explain why the task was canceled.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the return value is an error value.

Remarks

To cancel a task, the state of the task must be Configuring, Submitted, Queued, or Running. If a task is running when it is canceled, the task ends and the state of the task changes to Failed. If you cancel a task with a task of Configuring or Queued, the state of the task changes to Canceled.

If you cancel a parametric task, the state of the parametric master task always changes to Canceled, and all of the individual subtasks are canceled. If the subtask is running when you cancel the parametric task, the state of the subtask changes to Failed. If the subtask is in a state other than Running, the state of the subtask changes to Canceled.

To determine the state of a task, use the ISchedulerTask::State property.

You can call the ISchedulerJob::RequeueTask method to queue the task again.

The ISchedulerJob::CancelTask_2 method honors the grace period for the cancellation of the task.

To cancel a task without providing a message to the user that explains the reason you canceled the task, use the ISchedulerJob::CancelTask method.

To cancel a task immediately without using the grace period for canceling a task in Windows HPC Server 2008 R2, use the ISchedulerJob::CancelTask_3 method.

Calling the ISchedulerJob::CancelTask_2 method is equivalent to calling the ISchedulerJob::CancelTask_3 method with the isForce parameter set to VARIANT_FALSE. For better performance, call the ISchedulerJob::CancelTask_3 method with the isForce parameter set to VARIANT_FALSE instead of calling ISchedulerJob::CancelTask_2.

Requirements

Product

HPC Pack 2008 R2 Client Utilities

Type library

Microsoft.Hpc.Scheduler.tlb

See also

ISchedulerJob

ISchedulerJob::CancelTask

ISchedulerJob::CancelTask_3

ISchedulerJob::AddTask

ISchedulerJob::CreateTask

ISchedulerJob::SubmitTask