Partilhar via


BatchClient.GetSubTasks Method

Definition

Overloads

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

[Protocol Method] Lists all of the subtasks that are associated with the specified multi-instance Task.

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

Lists all of the subtasks that are associated with the specified multi-instance Task.

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

Source:
BatchClient.cs

[Protocol Method] Lists all of the subtasks that are associated with the specified multi-instance Task.

public virtual Azure.Pageable<BinaryData> GetSubTasks (string jobId, string taskId, int? timeOutInSeconds, DateTimeOffset? ocpdate, System.Collections.Generic.IEnumerable<string> select, Azure.RequestContext context);
abstract member GetSubTasks : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetSubTasks : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetSubTasks (jobId As String, taskId As String, timeOutInSeconds As Nullable(Of Integer), ocpdate As Nullable(Of DateTimeOffset), select As IEnumerable(Of String), context As RequestContext) As Pageable(Of BinaryData)

Parameters

jobId
String

The ID of the Job.

taskId
String

The ID of the Task.

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.

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

jobId or taskId is null.

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

This sample shows how to call GetSubTasks 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.GetSubTasks("<jobId>", "<taskId>", 1234, DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), new string[] { "<select>" }, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("affinityId").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("nodeUrl").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("poolId").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("nodeId").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("taskRootDirectory").ToString());
    Console.WriteLine(result.GetProperty("nodeInfo").GetProperty("taskRootDirectoryUrl").ToString());
    Console.WriteLine(result.GetProperty("startTime").ToString());
    Console.WriteLine(result.GetProperty("endTime").ToString());
    Console.WriteLine(result.GetProperty("exitCode").ToString());
    Console.WriteLine(result.GetProperty("containerInfo").GetProperty("containerId").ToString());
    Console.WriteLine(result.GetProperty("containerInfo").GetProperty("state").ToString());
    Console.WriteLine(result.GetProperty("containerInfo").GetProperty("error").ToString());
    Console.WriteLine(result.GetProperty("failureInfo").GetProperty("category").ToString());
    Console.WriteLine(result.GetProperty("failureInfo").GetProperty("code").ToString());
    Console.WriteLine(result.GetProperty("failureInfo").GetProperty("message").ToString());
    Console.WriteLine(result.GetProperty("failureInfo").GetProperty("details")[0].GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("failureInfo").GetProperty("details")[0].GetProperty("value").ToString());
    Console.WriteLine(result.GetProperty("state").ToString());
    Console.WriteLine(result.GetProperty("stateTransitionTime").ToString());
    Console.WriteLine(result.GetProperty("previousState").ToString());
    Console.WriteLine(result.GetProperty("previousStateTransitionTime").ToString());
    Console.WriteLine(result.GetProperty("result").ToString());
}

Applies to

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

Source:
BatchClient.cs

Lists all of the subtasks that are associated with the specified multi-instance Task.

public virtual Azure.Pageable<Azure.Compute.Batch.BatchSubtask> GetSubTasks (string jobId, string taskId, int? timeOutInSeconds = default, DateTimeOffset? ocpdate = default, System.Collections.Generic.IEnumerable<string> select = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetSubTasks : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchSubtask>
override this.GetSubTasks : string * string * Nullable<int> * Nullable<DateTimeOffset> * seq<string> * System.Threading.CancellationToken -> Azure.Pageable<Azure.Compute.Batch.BatchSubtask>
Public Overridable Function GetSubTasks (jobId As String, taskId As String, Optional timeOutInSeconds As Nullable(Of Integer) = Nothing, Optional ocpdate As Nullable(Of DateTimeOffset) = Nothing, Optional select As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Pageable(Of BatchSubtask)

Parameters

jobId
String

The ID of the Job.

taskId
String

The ID of the Task.

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.

select
IEnumerable<String>

An OData $select clause.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

jobId or taskId is null.

jobId or taskId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetSubTasks.

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

foreach (BatchSubtask item in client.GetSubTasks("<jobId>", "<taskId>"))
{
}

This sample shows how to call GetSubTasks with all parameters.

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

foreach (BatchSubtask item in client.GetSubTasks("<jobId>", "<taskId>", timeOutInSeconds: 1234, ocpdate: DateTimeOffset.Parse("Tue, 10 May 2022 18:57:31 GMT"), select: new string[] { "<select>" }))
{
}

Remarks

If the Task is not a multi-instance Task then this returns an empty collection.

Applies to