ICluster::CancelTasks method

Cancels one or more specified tasks.

Syntax

HRESULT CancelTasks(
  [in] long               jobId,
  [in] IClusterEnumerable *taskIds,
  [in] BSTR               Message
);

Parameters

  • jobId [in]
    The job identifier. The ICluster::AddJob method returns this value. If you have an instance of the job that has already been added to the cluster, you can call the IJob::get_Id method to get the identifier.

  • taskIds [in]
    An IClusterEnumerable interface that contains one or more task identifiers of the tasks to cancel. The ITask::get_Id method returns the task identifier value.

  • Message [in]
    A message that describes the reason why the tasks were canceled. The message is limited to 320 Unicode characters.

    The message is stored with each canceled task. To get the message, call the ITask::get_ErrorMessage method. This parameter can be NULL.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the return value is an error code. To get a description of the error, call the ICluster::get_ErrorMessage method.

Remarks

If you need to cancel multiple tasks, calling this method provides better performance than calling ICluster::CancelTask in a loop.

To create the enumerable object, call the ICluster::CreateClusterEnumerable method. Then, call the IClusterEnumerable::Add method to add task identifiers to the enumerable object. Set the lVal member of the variant to the task identifier. Set the variant type of the item to VT_I4.

To cancel a task, the task's status must be: not submitted, queued, or running. If a task is running when it is canceled, the task is terminated and the status of the task changes to TaskStatus_Cancelled. To determine a task's status, call the ITask::get_Status method.

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

If the method fails, only those tasks canceled before the failure are canceled.

Requirements

Product

Compute Cluster Pack Client Utilities

Type library

Ccpapi.tlb

See also

ICluster

ICluster::AddTasks

ICluster::CancelTask

ICluster::ListTasks

TaskStatus