Share via


ICluster::AddJob method

Adds the specified job to the cluster.

Syntax

HRESULT AddJob(
  [in]  IJob *Job,
  [out] long *pRetVal
);

Parameters

  • Job [in]
    An IJob interface that identifies the job to add to the cluster.

  • pRetVal [out]
    The identifier of the job that was added to the cluster. The identifier is unique within the cluster. Use the identifier to add tasks to the job and to submit or retrieve the job.

    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.

Remarks

To get an IJob interface pointer, call the ICluster::CreateJob method. You can also call the ICluster::GetJob method or one of the list methods to get an existing job to use as a template for adding similar jobs (or the same job) to the cluster.

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 the job contains tasks, call the ICluster::SubmitJob method to add the job to the scheduling queue. If the job does not contain tasks, call the ICluster::AddTask method to add a task to the job before calling the SubmitJob method.

Note that you can call the SubmitJob method on a job that does not contain tasks to reserve resources for the job. 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 AddJob and SubmitJob methods, you can call the ICluster::QueueJob method.

Requirements

Product

Compute Cluster Pack Client Utilities

Type library

Ccpapi.tlb

See also

ICluster

ICluster::AddJobs

ICluster::CancelJob

ICluster::ListJobs