ICluster::AddJobs method

Adds one or more specified jobs to the cluster.


  [in]  IClusterEnumerable *jobs,
  [out] IClusterEnumerable **pRetVal


  • jobs [in]
    An IClusterEnumerable interface that contains one or more IJob interfaces to the jobs that you want to add to the cluster.

  • pRetVal [out]
    An IClusterEnumerable interface that contains the identifiers of the jobs that were added to the cluster. The identifiers in this collection correspond directly to the jobs passed in the jobs parameter. Use the identifier to add tasks to the job and to submit or retrieve the job.

    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.

    Note that identifiers for jobs that are no longer in the cluster are reused.

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.


If you need to add multiple jobs to the cluster, calling this method provides better performance than calling the ICluster::AddJob method in a loop.

If this method fails to add one of the jobs to the cluster, none of the jobs are added to the cluster.

For an example that shows how to create the enumerable object for the jobs parameter and how to add jobs to it, see the Submitting a Job to the Scheduling Queue.

After you have added the job to the cluster, you must use the ICluster::ModifyJob or ICluster::ModifyJobTerm method to update the terms of the job.

If each job contains at least one task, call the ICluster::SubmitJobs method to add the jobs to the scheduling queue. If any jobs do not contain at least one task, call the ICluster::AddTask method to add at least one task to those jobs before calling the SubmitJobs method.

Note that you can call the SubmitJobs method on jobs that do not contain tasks to reserve resources for the jobs. If the IJob::put_RunUntilCanceled method's pRetVal parameter is VARIANT_TRUE, the job is scheduled and runs indefinitely or until it exceeds the run-time limit set in the IJob::put_Runtime method (then the job is canceled). If the put_RunUntilCanceled method's pRetVal parameter is VARIANT_FALSE, the job moves to the finished status.

As an alternative to calling both the AddJobs and SubmitJobs methods, you can call the ICluster::QueueJobs method.



Compute Cluster Pack Client Utilities

Type library


See also