你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
BatchClient.GetPoolNodeCounts Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetPoolNodeCounts(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, RequestContext) |
[Protocol Method] Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
|
GetPoolNodeCounts(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken) |
Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query. |
GetPoolNodeCounts(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetPoolNodeCounts(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Pageable<BinaryData> GetPoolNodeCounts (int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, Azure.RequestContext context);
abstract member GetPoolNodeCounts : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetPoolNodeCounts : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetPoolNodeCounts (timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), filter As String, context As RequestContext) As Pageable(Of BinaryData)
Parameters
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
The maximum number of items to return in the response. A maximum of 1000 applications can be returned.
- filter
- String
An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetPoolNodeCounts and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BinaryData item in client.GetPoolNodeCounts(null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
}
This sample shows how to call GetPoolNodeCounts with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BinaryData item in client.GetPoolNodeCounts(1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, "<filter>", null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("poolId").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("creating").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("idle").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("offline").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("preempted").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("rebooting").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("reimaging").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("running").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("starting").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("startTaskFailed").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("leavingPool").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("unknown").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("unusable").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("waitingForStartTask").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("dedicated").GetProperty("upgradingOS").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("creating").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("idle").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("offline").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("preempted").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("rebooting").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("reimaging").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("running").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("starting").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("startTaskFailed").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("leavingPool").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("unknown").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("unusable").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("waitingForStartTask").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("total").ToString());
Console.WriteLine(result.GetProperty("lowPriority").GetProperty("upgradingOS").ToString());
}
Applies to
GetPoolNodeCounts(Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, CancellationToken)
- Source:
- BatchClient.cs
Gets the number of Compute Nodes in each state, grouped by Pool. Note that the numbers returned may not always be up to date. If you need exact node counts, use a list query.
public virtual Azure.Pageable<Azure.Compute.Batch.BatchPoolNodeCounts> GetPoolNodeCounts (int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, string filter = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetPoolNodeCounts : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchPoolNodeCounts>
override this.GetPoolNodeCounts : Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchPoolNodeCounts>
Public Overridable Function GetPoolNodeCounts (Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional maxresults As Nullable(Of Integer) = Nothing, Optional filter As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of BatchPoolNodeCounts)
Parameters
The maximum time that the server can spend processing the request, in seconds. The default is 30 seconds. If the value is larger than 30, the default will be used instead.".
- ocpdate
- Nullable<DateTimeOffset>
The time the request was issued. Client libraries typically set this to the current system clock time; set it explicitly if you are calling the REST API directly.
The maximum number of items to return in the response. A maximum of 1000 applications can be returned.
- filter
- String
An OData $filter clause. For more information on constructing this filter, see https://docs.microsoft.com/en-us/rest/api/batchservice/odata-filters-in-batch#list-support-images.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetPoolNodeCounts.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BatchPoolNodeCounts item in client.GetPoolNodeCounts())
{
}
This sample shows how to call GetPoolNodeCounts with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
foreach (BatchPoolNodeCounts item in client.GetPoolNodeCounts(timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, filter: "<filter>"))
{
}