Partager via


Cancel a Job or Task

 

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

In HPC Cluster Manager, you can cancel one or more active jobs or tasks at any time. When you cancel a job, the 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 Cluster Manager.

Note

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

To cancel a job

  1. In Job Management, in the Navigation Pane, click All Jobs.

  2. In the job list, select one or more jobs.

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

To cancel a task

  1. In Job Management, in the Navigation Pane, click All Jobs.

  2. In the job list, click a job. The Detail Pane displays a list of tasks for that job.

  3. In the task list, select one or more tasks.

  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 Cancel 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 configuring the grace period, see Understanding Error Handling.

  • For information about using HPC Cluster Manager, see Overview of HPC Cluster Manager.

Additional references