다음을 통해 공유


BatchClient.GetNodes Method

Definition

Overloads

GetNodes(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, RequestContext)

[Protocol Method] Lists the Compute Nodes in the specified Pool.

GetNodes(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, CancellationToken)

Lists the Compute Nodes in the specified Pool.

GetNodes(String, Nullable<Int32>, Nullable<DateTimeOffset>, Nullable<Int32>, String, IEnumerable<String>, RequestContext)

Source:
BatchClient.cs

[Protocol Method] Lists the Compute Nodes in the specified Pool.

public virtual Azure.Pageable<BinaryData> GetNodes (string poolId, int? timeOutInSeconds, DateTimeOffset? ocpdate, int? maxresults, string filter, System.Collections.Generic.IEnumerable<string> select, Azure.RequestContext context);
abstract member GetNodes : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetNodes : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetNodes (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 Pageable(Of BinaryData)

Parameters

poolId
String

The ID of the Pool from which you want to list Compute Nodes.

timeOutInSeconds
Nullable<Int32>

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.

maxresults
Nullable<Int32>

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

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 GetNodes 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.GetNodes("<poolId>", null, null, null, null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.ToString());
}

This sample shows how to call GetNodes 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.GetNodes("<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());
}

Applies to

GetNodes(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.Pageable<Azure.Compute.Batch.BatchNode> GetNodes (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 GetNodes : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchNode>
override this.GetNodes : string * Nullable<int> * Nullable<DateTimeOffset> * Nullable<int> * string * seq<string> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchNode>
Public Overridable Function GetNodes (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 Pageable(Of BatchNode)

Parameters

poolId
String

The ID of the Pool from which you want to list Compute Nodes.

timeOutInSeconds
Nullable<Int32>

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.

maxresults
Nullable<Int32>

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

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

foreach (BatchNode item in client.GetNodes("<poolId>"))
{
}

This sample shows how to call GetNodes with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
BatchClient client = new BatchClient(endpoint, credential);

foreach (BatchNode item in client.GetNodes("<poolId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), maxresults: 1234, filter: "<filter>", select: new string[] { "<select>" }))
{
}

Applies to