Share via


ICluster::CancelJobs method

Cancels one or more specified jobs.

Syntax

HRESULT CancelJobs(
  [in] IClusterEnumerable *jobIds,
  [in] BSTR               Message
);

Parameters

  • jobIds [in]
    An IClusterEnumerable interface that contains one or more job identifiers of the jobs to cancel. The ICluster::AddJob method returns the job identifier. 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.

  • Message [in]
    A message that describes the reason why the jobs were canceled. The message is limited to 320 Unicode characters. This parameter can be NULL.

    The message is stored with each canceled job. To get the message, call the IJob::get_ErrorMessage method.

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 jobs, calling this method provides better performance than calling the ICluster::CancelJob method in a loop.

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

The jobs are removed from the queue but remain in the cluster until the value of the TTLCompletedJobs cluster configuration parameter is exceeded. For a description of this parameter, see the ICluster::SetClusterParameter method.

To cancel a job, the job's status must be: not submitted, queued, or running. If a job is running tasks when the job is canceled, the tasks are terminated and marked as failed. If you queue the job again, the tasks that were finished when the job was canceled stay finished, but all other tasks are queued (including those that failed).

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

Requirements

Product

Compute Cluster Pack Client Utilities

Type library

Ccpapi.tlb

See also

ICluster

ICluster::AddJobs

ICluster::CancelJob

ICluster::CancelTasks