ICluster::AddTasks method

Adds one or more specified tasks to the specified job.

Syntax

HRESULT AddTasks(
  [in]  long               jobId,
  [in]  IClusterEnumerable *tasks,
  [out] IClusterEnumerable **pRetVal
);

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.

  • tasks [in]
    An IClusterEnumerable interface that contains one or more tasks that you want to add to the job. The variant type of each item that you add to the enumerable object is VT_DISPATCH. Set the pdispVal member of the variant to the task's IDispatch interface. To get the IDispatch interface, call the QueryInterface method of ITask.

  • pRetVal [out]
    An IClusterEnumerable interface that contains the identifiers of the tasks that were added to the job. The identifiers in this collection correspond directly to the tasks passed in the tasks parameter. When you enumerate the identifiers in this collection, the identifiers are returned as variants. The variant type is VT_I4. Use the lVal member of the variant to access the identifier.

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 add multiple tasks to a job, calling this method provides better performance than calling the ICluster::AddTask method in a loop.

If this method fails to add one of the tasks to the job, none of the tasks are added to the job. The likely reason for failing to add a task to a job is if resource usage or run-time requirements of the task conflict with job.

A task cannot be modified after it is added to a job.

Requirements

Product

Compute Cluster Pack Client Utilities

Type library

Ccpapi.tlb

See also

ICluster

ICluster::AddTask

ICluster::CancelTasks

ICluster::ListTasks

IJob::AddTask