你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
BatchClient.GetNodesAsync 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
GetNodesAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, CancellationToken) |
Lists the Compute Nodes in the specified Pool. |
GetNodesAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, RequestContext) |
[Protocol Method] Lists the Compute Nodes in the specified Pool.
|
GetNodesAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, CancellationToken)
- Source:
- BatchClient.cs
Lists the Compute Nodes in the specified Pool.
public virtual Azure.AsyncPageable<Azure.Compute.Batch.BatchNode> GetNodesAsync (string poolId, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, int? maxresults = default, string filter = default, System.Collections.Generic.IEnumerable<string> select = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetNodesAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchNode>
override this.GetNodesAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Compute.Batch.BatchNode>
Public Overridable Function GetNodesAsync (poolId As String, 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 select As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of BatchNode)
Parameters
- poolId
- String
The ID of the Pool from which you want to list Compute Nodes.
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-nodes-in-a-pool.
- select
- IEnumerable<String>
An OData $select clause.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
poolId
is null.
poolId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetNodesAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchNode item in client.GetNodesAsync("<poolId>"))
{
}
This sample shows how to call GetNodesAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BatchNode item in client.GetNodesAsync("<poolId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, filter: "<filter>", select: new string[] { "<select>" }))
{
}
Applies to
GetNodesAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, RequestContext)
- Source:
- BatchClient.cs
[Protocol Method] Lists the Compute Nodes in the specified Pool.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetNodesAsync(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.AsyncPageable<BinaryData> GetNodesAsync (string poolId, int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, System.Collections.Generic.IEnumerable<string> select, Azure.RequestContext context);
abstract member GetNodesAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetNodesAsync : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetNodesAsync (poolId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), maxresults As Nullable(Of Integer), filter As String, select As IEnumerable(Of String), context As RequestContext) As AsyncPageable(Of BinaryData)
Parameters
- poolId
- String
The ID of the Pool from which you want to list Compute Nodes.
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-nodes-in-a-pool.
- select
- IEnumerable<String>
An OData $select clause.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<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
poolId
is null.
poolId
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call GetNodesAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);
await foreach (BinaryData item in client.GetNodesAsync("<poolId>", null, null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.ToString());
}
This sample shows how to call GetNodesAsync 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);
await foreach (BinaryData item in client.GetNodesAsync("<poolId>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), 1234, "<filter>", new string[] { "<select>" }, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("url").ToString());
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("schedulingState").ToString());
Console.WriteLine(result.GetProperty("stateTransitionTime").ToString());
Console.WriteLine(result.GetProperty("lastBootTime").ToString());
Console.WriteLine(result.GetProperty("allocationTime").ToString());
Console.WriteLine(result.GetProperty("ipAddress").ToString());
Console.WriteLine(result.GetProperty("affinityId").ToString());
Console.WriteLine(result.GetProperty("vmSize").ToString());
Console.WriteLine(result.GetProperty("totalTasksRun").ToString());
Console.WriteLine(result.GetProperty("runningTasksCount").ToString());
Console.WriteLine(result.GetProperty("runningTaskSlotsCount").ToString());
Console.WriteLine(result.GetProperty("totalTasksSucceeded").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("taskUrl").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("jobId").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("taskId").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("subtaskId").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("taskState").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("exitCode").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("containerInfo").GetProperty("containerId").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("containerInfo").GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("containerInfo").GetProperty("error").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("failureInfo").GetProperty("category").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("failureInfo").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("failureInfo").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("failureInfo").GetProperty("details")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("failureInfo").GetProperty("details")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("retryCount").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("lastRetryTime").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("requeueCount").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("lastRequeueTime").ToString());
Console.WriteLine(result.GetProperty("recentTasks")[0].GetProperty("executionInfo").GetProperty("result").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("commandLine").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("containerRunOptions").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("imageName").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("registry").GetProperty("username").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("registry").GetProperty("password").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("registry").GetProperty("registryServer").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("registry").GetProperty("identityReference").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("containerSettings").GetProperty("workingDirectory").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("autoStorageContainerName").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("storageContainerUrl").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("httpUrl").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("blobPrefix").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("filePath").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("fileMode").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("resourceFiles")[0].GetProperty("identityReference").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("environmentSettings")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("environmentSettings")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("userIdentity").GetProperty("username").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("userIdentity").GetProperty("autoUser").GetProperty("scope").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("userIdentity").GetProperty("autoUser").GetProperty("elevationLevel").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("maxTaskRetryCount").ToString());
Console.WriteLine(result.GetProperty("startTask").GetProperty("waitForSuccess").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("exitCode").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("containerInfo").GetProperty("containerId").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("containerInfo").GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("containerInfo").GetProperty("error").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("failureInfo").GetProperty("category").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("failureInfo").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("failureInfo").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("failureInfo").GetProperty("details")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("failureInfo").GetProperty("details")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("retryCount").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("lastRetryTime").ToString());
Console.WriteLine(result.GetProperty("startTaskInfo").GetProperty("result").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("errorDetails")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("errors")[0].GetProperty("errorDetails")[0].GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("isDedicated").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("protocol").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("publicIPAddress").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("publicFQDN").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("frontendPort").ToString());
Console.WriteLine(result.GetProperty("endpointConfiguration").GetProperty("inboundEndpoints")[0].GetProperty("backendPort").ToString());
Console.WriteLine(result.GetProperty("nodeAgentInfo").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("nodeAgentInfo").GetProperty("lastUpdateTime").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("publisher").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("offer").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("sku").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("version").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("virtualMachineImageId").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("imageReference").GetProperty("exactVersion").ToString());
Console.WriteLine(result.GetProperty("virtualMachineInfo").GetProperty("scaleSetVmResourceId").ToString());
}