編集

次の方法で共有


Get-AzBatchTaskCount

Gets the task counts for the specified job.

Syntax

Get-AzBatchTaskCount
   [-JobId] <String>
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchTaskCount
   [[-Job] <PSCloudJob>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzBatchTaskCount cmdlet gets the Azure Batch tasks count for a Batch job. Specify a job by either the JobId parameter or the Job parameter. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. If the validationStatus is unvalidated, then the Batch service has not been able to check state counts against the task states as reported in the List Tasks API. The validationStatus may be unvalidated if the job contains more than 200,000 tasks.

Examples

Example 1: Get task counts by ID

Get-AzBatchTaskCount -JobId "Job01" -BatchContext $Context

Active              : 1
Completed           : 0
Failed              : 0
Running             : 1
Succeeded           : 5
ValidationStatus    : Validated

This command gets the task counts for job Job01. Use the Get-AzBatchAccountKey cmdlet to assign a context to the $Context variable.

Parameters

-BatchContext

The BatchAccountContext instance to use when interacting with the Batch service. If you use the Get-AzBatchAccount cmdlet to get your BatchAccountContext, then Microsoft Entra authentication will be used when interacting with the Batch service. To use shared key authentication instead, use the Get-AzBatchAccountKey cmdlet to get a BatchAccountContext object with its access keys populated. When using shared key authentication, the primary access key is used by default. To change the key to use, set the BatchAccountContext.KeyInUse property.

Type:BatchAccountContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Job

Specifies the job that contains tasks that this cmdlet gets. To obtain a PSCloudJob object, use the Get-AzBatchJob cmdlet.

Type:PSCloudJob
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-JobId

The id of the job for which to get task counts.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

PSCloudJob

BatchAccountContext

Outputs

PSTaskCounts