ISchedulerJob::AddTask method

Adds the task to the job.

Syntax


HRESULT AddTask(
  [in] ISchedulerTask *pTask
);

Parameters

pTask [in]

An ISchedulerTask interface of the task to add to the job. To create the task, call the ISchedulerJob::CreateTask 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, access the ISchedulerJob::ErrorMessage property.

Remarks

Typically, you call this method while the job is in the Configuring state. After you submit the job (see IScheduler::SubmitJob), you must call the ISchedulerJob::SubmitTask or ISchedulerJob::SubmitTaskById method to add a task to the job if you want the task to run (if you call the AddTask method after the job is submitted, the task will not run until you submit the task). You cannot add or submit a task after the job finishes. If you call the SubmitTaskById method, you must first call the AddTask method to get a task identifier assigned to the task.

The task will run in the order in which it was added to the job.

Examples

For an example, see Creating and Submitting a Job.

Requirements

Product

HPC Pack 2008 R2 Client Utilities, HPC Pack 2008 Client Utilities

Type library

Microsoft.Hpc.Scheduler.tlb

See also

ISchedulerJob
ISchedulerJob::CreateTask
ISchedulerJob::GetTaskIdList
ISchedulerJob::SubmitTask
ISchedulerTask

 

 

Show: