IScheduler::CancelJob method

Cancels the specified job.

Syntax

HRESULT CancelJob(
  [in] long jobId,
  [in] BSTR message
);

Parameters

  • jobId [in]
    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.

  • message [in]
    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.

Return value

If the method succeeds, the return value is S_OK. Otherwise, the return value is an error code.

Remarks

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.

Requirements

Product

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

Type library

Microsoft.Hpc.Scheduler.tlb

See also

IScheduler

IScheduler::CancelJob_2

IScheduler::AddJob

IScheduler::CreateJob

IScheduler::SubmitJob

IScheduler::OpenJob