Cancels the specified job.
HRESULT CancelJob( [in] long jobId, [in] BSTR message );
The job to cancel. The scheduler assigns the identifier when you call the IScheduler::AddJob method to add the job to the scheduler. To get the identifier, access the ISchedulerJob.Id property.
A message that describes the reason why the job was canceled. The message is limited to 320 Unicode characters. Can be empty.
The message is stored with the job. To get the message, access the ISchedulerJob.ErrorMessage property.
If the method succeeds, the return value is S_OK. Otherwise, the return value is an error code.
The job is removed from the queue but remains in the scheduler. The TTLCompletedJobs cluster parameter (for details, see the Remarks section of IScheduler::SetClusterParameter) determines when the job is removed from the scheduler after it has been canceled.
To cancel a job, the state of the job must be configuring, submitted, validating, queued, or running. If the job is running tasks when the job is canceled, the tasks are stopped and marked as failed. If you queue the job again, the tasks in the job are treated as follows:
- Tasks that were finished when the job was canceled stay finished.
- Tasks that were explicitly canceled before they ran and that are currently in the canceled state stay canceled.
- All other tasks are queued, including those that failed.
To cancel a command job, the user must be running as an administrator.
This method honors all cancelation grace periods for currently running tasks, and runs any node release task that exists for the job on all nodes currently allocated to the job.
To stop the job immediately in Windows HPC Server 2008 R2 without using the grace period for canceling the tasks in the job and without running any node release task that the job includes, use the IScheduler::CancelJob_2 method. Calling the IScheduler::CancelJob method is equivalent to calling the IScheduler::CancelJob_2 method with the isForced parameter set to VARIANT_FALSE.
HPC Pack 2008 R2 Client Utilities, HPC Pack 2008 Client Utilities