Get-HpcTask

Gets a task or subtask for a job.

Syntax

Get-HpcTask
   -JobId <Int32>
   [-TaskId <Int32>]
   [-SubTaskId <Int32>]
   [-State <TaskState[]>]
   [-ClusterConnectionString <String[]>]
   [-Scheduler <String[]>]
   [<CommonParameters>]
Get-HpcTask
   -Job <HpcJob>
   [-TaskId <Int32>]
   [-SubTaskId <Int32>]
   [-State <TaskState[]>]
   [-ClusterConnectionString <String[]>]
   [-Scheduler <String[]>]
   [<CommonParameters>]

Description

The Get-HpcTask cmdlet gets a specified task or subtask for the specified job, or gets a list of all tasks for the specified job. You can cancel, requeue, or submit the task that you get with this cmdlet by using the Cancel, Requeue, or Submit method of the HpcTask object that the cmdlet returns.

Examples

Example 1: Get a task by ID

PS C:\>Get-HpcTask -JobId 35 -TaskId 4

This command gets the fourth task from the job with a job ID of 35.

Example 2: Get all tasks from a job

PS C:\>Get-HpcJob -Id 35 | Get-HpcTask

This command gets all of the tasks from the job with a job ID of 35.

Example 3: Use HpcTask object methods

PS C:\>$T = Get-HpcTask -JobId 3 -TaskId 1 
PS C:\> $T.Requeue() $T.Cancel() $T.Submit()

The first command gets the specified HpcTask object, and then stores it in the $T variable.

The second command uses the methods of the HpcTask object in $T to requeue, cancel, and submit a task.

Example 4: Get a parametric subtask

PS C:\>Get-HpcTask -JobId 3 -TaskId 1 -SubTaskId 95

This command gets the ninety-fifth step of the parametric sweep task that is the first task in the job with a job ID of 3.

Required Parameters

-Job

Specifies an HpcJob object that corresponds to the job that contains the tasks or subtasks that you want to get. Use the Get-HpcJob cmdlet to get an HpcJob object for a job. You can specify either the Job parameter or the JobId parameter, but not both parameters at the same time.

Type:HpcJob
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-JobId

Specifies the job ID for the job that contains the tasks or subtasks that you want to get. Use the Get-HpcJob cmdlet to view a list of jobs and their job IDs.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-ClusterConnectionString

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.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Scheduler

Specifies the host name or IP address of the head node for the cluster that includes the tasks or subtasks. 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\>

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-State

Specifies an array of states that the tasks or subtasks that you want to get should have. Valid values are:

  • Configuring
  • Submitted
  • Validating
  • Queued
  • Dispatching
  • Running
  • Finishing
  • Finished
  • Failed
  • Canceled
  • Canceling
  • All
Type:TaskState[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SubTaskId

Specifies the subtask ID for the subtask that you want to get. Only parametric tasks have subtasks. A parametric task has one task ID and multiple subtask IDs.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TaskId

Specifies the ID of the task that you want to get.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

HpcJob

Outputs

HpcTask

Notes

  • If you specify the Job or JobId parameter, but not the TaskId or SubTaskID parameter, this cmdlet gets all of the tasks in the specified job. If any of the tasks are parametric tasks, the cmdlet also gets all of the subtasks of the parametric task.

    If you specify the Job or JobId parameter and specify a parametric task for the TaskId parameter, but do not specify the SubTaskID parameter, this cmdlet gets the parametric task, but not the subtasks of the parametric task.