Stop-HpcTask

Stop-HpcTask

Cancels the specified task or subtask.

Syntax

Parameter Set: id
Stop-HpcTask -JobId <Int32> -TaskId <Int32> [-Force] [-Message <String> ] [-Scheduler <String> ] [-SubTaskId <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: task
Stop-HpcTask -Task <HpcTask> [-Force] [-Message <String> ] [-Scheduler <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

Cancels the specified task or subtask. You can specify a task or subtask by specifying an HpcTask object for the task or subtask, or by specifying the job, task, and subtask identifiers.

When you cancel a task or subtask, the job scheduler removes the task or subtask from the queue if the task or subtask is waiting to run. If the task or subtask is running, the scheduler stops the task or subtask and frees the resources that it was using so that they can be allocated to other jobs.

Only an administrator or the owner of the job that contains a task or subtask can cancel the task or subtask.

Parameters

-Force

Stops the task immediately without using the grace period for task cancelation. Only tasks that respond when the user types CTRL+BREAK can use the grace period for task cancelation.

Aliases

none

Required?

false

Position?

named

Default Value

not applicable

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobId<Int32>

Specifies the job identifier of the job that includes the task or subtask that you want to cancel. You cannot specify both the JobId and Task parameters. If you specify the JobId parameter, you must also specify the TaskId parameter.

Aliases

none

Required?

true

Position?

named

Default Value

no default

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Message<String>

Specifies a message that indicates the reason that you are canceling the task.

Aliases

none

Required?

false

Position?

named

Default Value

no default

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Scheduler<String>

Specifies the host name or IP address of the head node for the HPC cluster to which the job that contains the task or subtask that you want to cancel was submitted. The value must be a valid computer name or IP address. If you do not specify the Scheduler parameter, this cmdlet uses the scheduler on the head node that the CCP_SCHEDULER environment variable specifies. To set this environment variable, run the following cmdlet:

Set-Content Env:CCP_SCHEDULER <head_node_name>

Aliases

none

Required?

false

Position?

named

Default Value

%CCP_SCHEDULER%

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubTaskId<Int32>

Specifies the subtask identifier of the subtask that you want to cancel. If you specify the SubTaskId parameter, you must also specify the JobId and TaskId parameters. You cannot specify both the SubTaskId and Task parameters.

Aliases

none

Required?

false

Position?

named

Default Value

no default

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Task<HpcTask>

Specifies the task or subtask that you want to cancel. Use the Get-HpcTask cmdlet to get the HpcTask object for the task or subtask. You cannot specify the Task parameter if you also specify the JobId, the TaskId, or the SubtaskId parameter.

Aliases

none

Required?

true

Position?

named

Default Value

no default

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-TaskId<Int32>

Specifies the task identifier of the task that you want to cancel. If you specify the TaskId parameter, you must also specify the JobId parameter. You cannot specify both the TaskId and Task parameters.

Aliases

none

Required?

true

Position?

named

Default Value

no default

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

Required?

false

Position?

named

Default Value

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • An HpcTask object

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

Notes

  • The built-in ConfirmImpact setting for this cmdlet is Medium. If this ConfirmImpact setting is equal to or higher than the value of the $ConfirmPreference variable for your environment, the cmdlet prompts for confirmation unless you specify –Confirm:$false. If this ConfirmImpact setting is lower than the value of the $ConfirmPreference variable for your environment, the cmdlet does not prompt for confirmation unless you specify –Confirm or –Confirm:$true.

  • This cmdlet was introduced in HPC Pack 2008 R2. It is not supported in previous versions.

Examples

EXAMPLE 1

Cancels the task with a task identifier of 2 in the job with a job identifier of 12.

PS C:\>Stop-HpcTask –JobId 12 –TaskId 2

EXAMPLE 2

Cancels the subtask with a subtask identifier of 12 for the task with a task identifier of 3 in the job with a job identifier of 46 without using the grace period for task cancelation, and then sets the message that explains the reason for the cancelation to "Clearing space for other tasks that need to run immediately."

PS C:\>Stop-HpcTask –JobId 46 –TaskId 3 –SubTaskId 12 –Message "Clearing space for other tasks that need to run immediately." -Force

EXAMPLE 3

Gets an HpcTask object for the task with a task identifier of 1 in the job with a job identifier of 25, then cancels that task by redirecting that HpcTask object to the input of the Stop-HpcTask cmdlet.

PS C:\>GetHpcTask –JobId 25 –TaskId 1 | Stop-HpcTask

Get-HpcTask

Stop-HpcJob

Submit-HpcJob