Partager via


Cancel a Job or Task

 

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

In HPC Job Manager, you can cancel one or more active jobs or tasks at any time. When you cancel a job, the HPC Job Scheduler Service removes the job from the queue if it is waiting to run. If it is running, the scheduler stops the tasks that are running and frees the resources that they were using. Node Release tasks run even when a job is canceled. To skip the Node Release task, see Force Cancel a Job or Task.

You can use the following procedures to cancel jobs or tasks using HPC Job Manager.

Note

To complete this procedure, you must be the job owner or a cluster administrator.

To cancel a job

  1. In HPC Job Manager, in the Navigation Pane, click My Jobs.

  2. In the job list, click the job or jobs that you want to cancel.

  3. Right-click your selection and click Cancel Job.

To cancel a task

  1. In HPC Job Manager, in the Navigation Pane, click My Jobs.

  2. In the job list, click the job that contains the task you want to cancel. The Detail Pane displays a list of tasks for that job.

  3. In the task list, click the task or tasks that you want to cancel.

  4. Right-click your selection and click Cancel Task.

Guidelines for canceling jobs and tasks

When you cancel a Running job:

  • The job is marked as Canceled.

  • Running tasks are marked as Failed.

  • Queued tasks remain in the Queued state.

When you cancel a Queued job:

  • The job is marked as Canceled.

  • Queued tasks remain in the Queued state.

When you cancel a task:

  • Running tasks are marked as Failed.

  • Queued tasks are marked as Canceled.

Tasks that are in the Canceled state are not automatically requeued when you requeue the job that contains them.

Note

If you want to stop a running job and you want the final job state to be marked as Finished rather than as Canceled, and the running tasks in the job to be marked as Finished rather than as Failed, you can use the following command prompt or HPC PowerShell methods, where <yourJobID> is the ID of your job:

  • In HPC PowerShell, use the following cmdlet: Stop-hpcjob –state finished –id <yourJobID>

  • At a command prompt, use the following command: Job finish <yourJobID>

Additional considerations

  • In Microsoft® HPC Pack, canceled tasks can make use of the Task Cancelation Grace Period to save state information and clean up before exiting. The default grace period is 15 seconds. To use the grace period, the application must process the CTRL_BREAK event. If the application does not process the event, the task exits immediately. For a service to use the grace period, it must process the ServiceContext.OnExiting event. Tasks that are force canceled skip the grace period.

  • For information about basic terminology, opening HPC Job Manager, and connecting to a cluster, see Overview of HPC Job Manager.

Additional references