Stop-HpcTask

Stop-HpcTask

Cancels a task or subtask.

Syntax

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

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




Detailed Description

The Stop-HpcTask cmdlet 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 IDs. You can also specify that the state of the task after it is canceled should be Finished instead of Canceled.

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

-ClusterConnectionString<String[]>

Specifies an array of cluster connection strings for the cluster to which you want to add the device drivers. The value format is host1,host2,host3. If you do not specify the ClusterConnectionString parameter, this cmdlet uses the connection string on the head node that the CCP_CONNECTIONSTRING environment variable specifies. To set this environment variable, run the following cmdlet: Set-Content Env: CCP_CONNECTIONSTRING <head_node_name>.

This parameter was introduced in HPC Pack 2016.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-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

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobId<Int32>

Specifies the job ID 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

none

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

none

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

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-State<String>

Specifies the state of the task after it is canceled. The only valid value is Finished. If you do not specify the State parameter, the task has a state of Canceled after it is canceled.

Use this parameter when you want to end a task process immediately.

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubTaskId<Int32>

Specifies the subtask ID 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

none

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

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-TaskId<Int32>

Specifies the task ID 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

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

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

Inputs

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

  • HpcTask

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: Stop a task by ID

This command cancels the task with a task ID of 2 in the job with a job ID of 12.


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

Example 2: Stop a subtask by ID

This command cancels the subtask with a subtask ID of 12 for the task with a task ID of 3 in the job with a job ID 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: Get a task by ID and stop it

This command gets an HpcTask object for the task with a task ID of 1 in the job with a job ID of 25, and 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

Example 4: Stop a task and set its state

This command cancels the subtask with a subtask ID of 5 for the task with a task ID of 1 in the job with a job ID of 5, and sets the state of the task after it is canceled to Finished.


PS C:\> Stop-HpcTask -JobId 5 -TaskId 1 -SubTaskId 5 -State Finished

Related topics

Community Additions

ADD
Show: