共用方式為


Job - Get Task Counts

取得指定之作業的工作計數。
工作計數會依作用中、執行中或已完成的工作狀態,以及成功或失敗的工作計數來提供工作計數。 準備狀態中的工作會計算為執行中。 請注意,傳回的數位不一定是最新的。 如果您需要確切的工作計數,請使用清單查詢。

GET {batchUrl}/jobs/{jobId}/taskcounts?api-version=2024-07-01.20.0
GET {batchUrl}/jobs/{jobId}/taskcounts?timeout={timeout}&api-version=2024-07-01.20.0

URI 參數

名稱 位於 必要 類型 Description
batchUrl
path True

string

所有 Azure Batch 服務要求的基底 URL。

jobId
path True

string

作業的標識碼。

api-version
query True

string

用戶端 API 版本。

timeout
query

integer (int32)

伺服器可以花費數秒處理要求的時間上限。 預設值為30秒。 如果值大於 30,則會改用預設值。

要求標頭

Media Types: "application/json; odata=minimalmetadata"

名稱 必要 類型 Description
client-request-id

string (uuid)

呼叫端產生的要求身分識別,格式為 GUID,不含大括弧,例如 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0。

return-client-request-id

boolean

伺服器是否應該在回應中傳回 client-request-id。

ocp-date

string (date-time-rfc1123)

發出要求的時間。 用戶端連結庫通常會將此設定為目前的系統時鐘時間;如果您要直接呼叫 REST API,請明確設定它。

回應

名稱 類型 Description
200 OK

TaskCountsResult

包含指定作業之工作計數的回應。

標題

  • client-request-id: string
  • request-id: string
Other Status Codes

BatchError

Batch 服務的錯誤。

安全性

azure_auth

Microsoft Entra OAuth 2.0 驗證碼流程

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 模擬您的用戶帳戶

Authorization

類型: apiKey
位於: header

範例

Job get task counts

範例要求

GET account.region.batch.azure.com/jobs/jobId/taskcounts?api-version=2024-07-01.20.0


範例回覆

{
  "taskCounts": {
    "active": 5,
    "running": 7,
    "completed": 4,
    "succeeded": 2,
    "failed": 2
  },
  "taskSlotCounts": {
    "active": 5,
    "running": 7,
    "completed": 4,
    "succeeded": 2,
    "failed": 2
  }
}

定義

名稱 Description
BatchError

從 Azure Batch 服務收到的錯誤回應。

BatchErrorDetail

Azure Batch 錯誤回應中包含的其他信息專案。

ErrorMessage

Azure Batch 錯誤回應中收到的錯誤訊息。

TaskCounts

作業的工作計數。

TaskCountsResult

Task 和 TaskSlot 會計算作業的計數。

TaskSlotCounts

TaskSlot 會計算作業的計數。

BatchError

從 Azure Batch 服務收到的錯誤回應。

名稱 類型 Description
code

string

錯誤的識別碼。 程序代碼是不變的,而且是要以程序設計方式取用。

message

ErrorMessage

描述錯誤的訊息,適用於在使用者介面中顯示。

values

BatchErrorDetail[]

索引鍵/值組的集合,其中包含錯誤的其他詳細數據。

BatchErrorDetail

Azure Batch 錯誤回應中包含的其他信息專案。

名稱 類型 Description
key

string

指定 Value 屬性意義的識別碼。

value

string

錯誤回應隨附的其他資訊。

ErrorMessage

Azure Batch 錯誤回應中收到的錯誤訊息。

名稱 類型 Description
lang

string

錯誤訊息的語言代碼

value

string

訊息的文字。

TaskCounts

作業的工作計數。

名稱 類型 Description
active

integer (int32)

處於作用中狀態的工作數目。

completed

integer (int32)

處於已完成狀態的工作數目。

failed

integer (int32)

失敗的工作數目。 如果工作的結果(在 executionInfo 屬性中找到)為「失敗」,工作就會失敗。

running

integer (int32)

處於執行中或準備狀態的工作數目。

succeeded

integer (int32)

成功的工作數目。 如果工作的結果 (在 executionInfo 屬性中找到) 為 'success',工作就會成功。

TaskCountsResult

Task 和 TaskSlot 會計算作業的計數。

名稱 類型 Description
taskCounts

TaskCounts

每個狀態的工作數目。

taskSlotCounts

TaskSlotCounts

工作每個狀態所需的TaskSlot數目。

TaskSlotCounts

TaskSlot 會計算作業的計數。

名稱 類型 Description
active

integer (int32)

使用中工作的TaskSlot數目。

completed

integer (int32)

已完成工作的TaskSlot數目。

failed

integer (int32)

失敗工作的TaskSlot數目。

running

integer (int32)

用於執行工作的TaskSlot數目。

succeeded

integer (int32)

成功工作的TaskSlot數目。