Share via


Get-HpcTask

Gets a task or subtask for a job.

Syntax

id (Default)

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

job

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.

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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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.

Parameter properties

Type:HpcJob
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

job
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

id
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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\>

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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

Parameter properties

Type:

TaskState[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TaskId

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

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

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.