Share via


job cancel

 

Applies To: Microsoft HPC Pack 2012, Microsoft HPC Pack 2012 R2

Cancels a specified running or pending job.

For examples of how to use this command, see Examples.

Syntax

job cancel <jobID> [/force] [/graceful] [/message:<message>] [/scheduler:<name>]

job cancel {/? | /help}

Parameters

Parameter

Description

<jobID>

Specifies the identifier for the job that you want to cancel.

/force

Stops the job immediately, without using the grace period for task cancelation and without running the node release task, if the job contains one.

This parameter was introduced in Microsoft® HPC Pack 2008 R2 and is not supported in previous versions.

/graceful

Stops the job gracefully, by letting running tasks complete.

This parameter was introduced in HPC Pack 2012 R2 Update 1 and is not supported in previous versions.

/message:<message>

Specifies an error message to provide to the user that explains why you canceled the job. The maximum length of the message is 128 characters.

/scheduler:<name>

Specifies the host name or IP address of the head node for the cluster to which you submitted the job. The value must be a valid computer name or IP address. If you do not specify the /scheduler parameter, this command uses the scheduler on the head node that the CCP_SCHEDULER environment variable specifies.

/?

Displays Help at the command prompt.

/help

Displays Help at the command prompt.

Remarks

  • To cancel a job, the state of the job must be Configuring, Submitted, Validating, Queued, or Running.

    When you cancel a job, the HPC Job Scheduler Service removes the job from the job queue if the job is waiting to run.

  • If the job is running, the HPC Job Scheduler Service stops the tasks that are running and frees the resources that they were using so they can be allocated to another job. The HPC Job Scheduler Service also sets the state of the tasks that were running to Failed.

  • If you queue the job again, the way that tasks in the job are treated depends on the state of the tasks when you can canceled the job. Tasks that were finished when you canceled the job 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.

  • When you cancel a job with job cancel command, the state of the job changes to Canceled. Starting in HPC Pack 2008 R2, you can also stop a job and change the state of the job to Finished by calling the job finish command.

Examples

To cancel the job with a job identifier of 45 and provide the user with a cancellation message that explains that you canceled the job to make room for a different job to run, use the following command:

job cancel 45 /message:"Clearing space for job 51, which needs to run immediately."

To cancel the job with a job identifier of 469 immediately, without using the grace period for task cancelation and without running the node release task, use the following command:

job cancel 469 /force

To cancel the job with a job identifier of 12 gracefully, so that running tasks complete, use the following command:

job cancel 12 /graceful

Additional references