Share via


Cluster.CancelTasks Method

Cancels one or more specified tasks.

Namespace: Microsoft.ComputeCluster
Assembly: CcpAPI (in ccpapi.dll)

Usage

Syntax

'Declaration
Public Sub CancelTasks ( _
    jobId As Integer, _
    taskIds As IClusterEnumerable, _
    message As String _
)
public void CancelTasks (
    int jobId,
    IClusterEnumerable taskIds,
    string message
)
public:
virtual void CancelTasks (
    int jobId, 
    IClusterEnumerable^ taskIds, 
    String^ message
) sealed
public final void CancelTasks (
    int jobId, 
    IClusterEnumerable taskIds, 
    String message
)
public final function CancelTasks (
    jobId : int, 
    taskIds : IClusterEnumerable, 
    message : String
)

Parameters

  • jobId
    The job identifier. The Cluster.AddJob method returns this value. If you have a job object that has already been added to the cluster, you can access the Job.Id property to get the identifier.
  • message
    A message that describes the reason why the tasks were canceled. The message is limited to 320 Unicode characters. This parameter can be NULL.

    The message is stored with each canceled task. To get the message, access the Task.ErrorMessage property.

Remarks

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

To create the enumerable object that contains the collection of task identifiers, call the Cluster.CreateClusterEnumerable method. Then, call the ClusterEnumerable.Add method for each task identifier that you want to add to the enumerable object.

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 Cancelled (see TaskStatus). To determine a task's status, access the Task.Status property.

You can call the Cluster.RequeueTask method to queue the task again.

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

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Microsoft Windows Compute Cluster Server 2003, Windows Server 2003, Windows XP

Target Platforms

Microsoft Windows Compute Cluster Server 2003, Windows Server 2003 with Compute Cluster Pack Client Utilities, Windows XP with Compute Cluster Pack Client Utilities

See Also

Reference

Cluster Class
Cluster Members
Microsoft.ComputeCluster Namespace
Cluster.AddTasks Method
Cluster.CancelTask Method
ListTasks
TaskStatus